---
title: How to Calculate the Days in a Selected Period SAP BW Report [Tutorial]
description: Learn how to calculate a SAP BW based key figure that shows the days in a selected report period, used especially in the construction industry.
image: https://www.sapbwconsulting.com/hs-fs/file-16576118-png/images/new_formula_variable_1.png
---

![](https://www.sapbwconsulting.com/hs-fs/file-16576118-png/images/new_formula_variable_1.png)

# How to Calculate the Days in a Selected Period SAP BW Report [Tutorial]

 Table of Contents

## How to Calculate a Period of Time in [SAP BW](https://www.sapbwconsulting.com/understanding-sap-bw-in-5-minutes)

### No Customer Exit Required!

Have you ever needed to [calculate](https://www.sapbwconsulting.com/fully-loaded-cost-calculator) the number of days in a selected period for a [report](https://www.sapbwconsulting.com/blog/how-to-get-the-webi-universe-data-source-connection-setup) (without using a [customer exit](https://www.sapbwconsulting.com/blog/understanding-the-most-common-sap-data-warehousing-concepts)!) in [SAP BW](https://www.sapbwconsulting.com/sap-bw-3.x-to-7.x-upgrade-service-productized-approach-proprietary-methodolgy)?    That’s right, you can do it entirely without resorting to a [customer exit](https://www.sapbwconsulting.com/blog/identifying-cause-of-data-load-error-when-using-a-sap-bw-dtp), thus [avoiding coding](https://www.sapbwconsulting.com/sap-sem-cpm-risk-register-design-template) and drastically improving [Total Cost of Ownership](https://www.sapbwconsulting.com/net-present-value-npv-template) ([TCO](https://www.sapbwconsulting.com/total-cost-of-ownership-tco)).

## Uses of Days in Period

 

**Business Scenario:**  You need to calculate some [personnel metrics](https://www.sapbwconsulting.com/blog/5-kpi-design-best-practice-guidelines) like equivalent [labor class or craft their related loaded cost](https://www.sapbwconsulting.com/blog/how-to-determine-your-fully-loaded-cost-rate). The [formula](https://www.sapbwconsulting.com/blog/inbound-marketing/how-to-correctly-calculate-conversion-rate-3-easy-formulas-to-use) is to take the the total number of [absences](https://www.sapbwconsulting.com/blog/10-things-you-need-to-know-about-sap-s-hrms) and divide by the number of available work days (the client doesn't have the system calendar set to give work days, and they change the number of work days at report execution time).

### Just follow the steps below and you can easily do the calculation:

 

 1.  Create a new calculated [Key Figure](https://www.sapbwconsulting.com/blog/how-to-model-key-figures-sap-bw-tutorial)  
2.  Create a new formula variable 

![Calculated Key Figure](https://www.sapbwconsulting.com/hs-fs/file-16576118-png/images/new_formula_variable_1.png?width=272&height=271&name=new_formula_variable_1.png)

3.  Make selections similar to what you see in this screen. We will **process by replacement path** and **reference characteristic** 0CALDAY. 0CALDAY is used in this report as the main date field and the [user is prompted](https://www.sapbwconsulting.com/blog/inbound-marketing/how-important-is-data-governance-to-internet-marketing) to enter a **Date From** and **Date to** in the same variable (a mandatory interval variable).

![Display Variable 2 resized 600](https://www.sapbwconsulting.com/hs-fs/file-16554376-png/images/display_variable_2-resized-600.png)

4.  Go to the [**Replacement Path** tab](https://www.sapbwconsulting.com/blog/inbound-marketing/10-ways-profound-knowledge-can-improve-building-landing-pages). Here you will enter the name of the variable used on 0CALDAY and define the “replace variable with” to ‘variable’. We also **change** the **“Use Interval”** to **‘Difference’**. [This will give us](https://www.sapbwconsulting.com/blog/learn-what-makes-sap-dfps-solution-different) the difference between the two selected dates.

![Based on InfoCube](https://www.sapbwconsulting.com/hs-fs/file-16554755-png/images/display_variable_3-resized-600.png)

![BEx Query Designer XBO resized 600](https://www.sapbwconsulting.com/hs-fs/file-16539764-png/images/bex_query_designer_xbo-resized-600.png)

 

5.  Finally, use this [newly created formula](https://www.sapbwconsulting.com/blog/inbound-marketing/3-multi-channel-marketing-lessons-learned-catching-the-big-one) variable in the new calculated key figure. 

   
![Display Calculated Key Figure resized 600](https://www.sapbwconsulting.com/hs-fs/file-16554031-png/images/display_calculated_key_figure-resized-600.png)

Figure 1 - Query definition showing 0CALDAY filter and the variable used

 

 6.  Now you can insert this calculated key figure into your report. You will get a column that repeats the result for each row. This can be handy for other calculations such as **[calculating](https://www.sapbwconsulting.com/blog/inbound-marketing/the-guaranteed-easiest-way-to-calculate-sla) the number of available workdays** in a [period](https://www.sapbwconsulting.com/marketing-and-sales-sla-calculator-service-level-agreement). (In our case, the user enters the number of workdays manually at the report prompt screen). Then we calculated the number of weeks times the number of workdays and used the result for our final metric.   

![Final Result resized 600](https://www.sapbwconsulting.com/hs-fs/file-16559228-png/images/final_result-resized-600.png)

 

Figure 2 - Final Result

 

 

There you have it, a solution to one of the most common tasks a BW Consultant needs to solve on a project. 

 

Want to have a copy of this [tutorial](https://www.sapbwconsulting.com/sap-training-courses) for future reference?  Click the button to get your copy.

 

[![Download the Tutorial  on  How to Calculate  the Number of Days in a Period](https://no-cache.hubspot.com/cta/default/118735/c09b7d01-6226-41d5-819d-f27ab5947468.png)](https://cta-redirect.hubspot.com/cta/redirect/118735/c09b7d01-6226-41d5-819d-f27ab5947468)

 

**Do You Have Any Other Tips to Share or Problems You Need Some Help With?**

 

Thanks

 

People Who Read This Also Read:

- 1 Key Tip [When Upgrading](https://www.sapbwconsulting.com/blog/1-key-tip-when-upgrading-from-sap-bw-3-x-to-bw-7-x) from SAP BW 3.X to BW 7.X [Checklist]
- 10 Advanced SAP BW [Project Estimation](https://www.sapbwconsulting.com/blog/10-advanced-sap-bw-project-estimation-techniques) Techniques [Online Tool]
- Learn What is [Catch Weight Management](https://www.sapbwconsulting.com/blog/learn-what-is-catch-weight-management)
- Top 10 Benefits for Financial Analysis in the [Latest SAP EP4](https://www.sapbwconsulting.com/blog/top-10-benefits-for-financial-analysis-in-the-latest-sap-ep4)
- BusinessObjects [Explorer](https://www.sapbwconsulting.com/blog/businessobjects-explorer-best-practices) Best Practices

 

Please Let Us Know if You Have Any Questions or Comments!

 

## **About SAP BW Consulting, Inc.**

 

SAP BW Consulting, Inc. provides comprehensive SAP solutions, including SAP Business Intelligence (BI) and SAP Business Warehouse (BW) consulting, SAP ABAP development, and project management. Our services also include a [1099 Contractor Invoicing and Payment Management System](https://www.sapbwconsulting.com/blog/1099-contractor-payments), Salesforce consulting, and Balanced Scorecard consulting for [strategic planning](https://www.sapbwconsulting.com/blog/five-forces-model). As HubSpot Marketing and Sales Partners, we specialize in Google Ads, Facebook Ads, LinkedIn Ads, Account-Based Marketing, Content Marketing, and Ecommerce solutions, including Shopify.

 

Ready to optimize your operations and strategy? [Book a meeting with us](https://www.sapbwconsulting.com/request-sap-implementation-consulting-support-meeting-request).

Topics from this blog:

[BEx](https://www.sapbwconsulting.com/blog/topic/bex) [BW Time Calculations](https://www.sapbwconsulting.com/blog/topic/bw-time-calculations) [Best Practices](https://www.sapbwconsulting.com/blog/topic/best-practices) [How-To](https://www.sapbwconsulting.com/blog/topic/how-to)

### Download SAP BW Mindmap

Learn what SAP Business Warehouse is and what it does in under five minutes

[![Get this Mindmap](https://no-cache.hubspot.com/cta/default/118735/8db2ad37-8211-47a3-86ae-09b6b2bb297b.png)](https://cta-redirect.hubspot.com/cta/redirect/118735/8db2ad37-8211-47a3-86ae-09b6b2bb297b)

<https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#> <https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#> <https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#> [mailto:someone@yoursite.com](mailto:someone@yoursite.com)

### Victor Ayers

Victor is a SAP Certified SAP Business Warehouse and BusinessObjects Consultant with deep SAP HANA architecture expertise.

[View All Articles by Victor Ayers](https://www.sapbwconsulting.com/blog/author/victor-ayers)

## The SAP Blog

Subscribe to our blog and receive SAP BW Updates, demand generation, inbound marketing, sales enablement, technology and revenue generation insights and ideas delivered right to your email.

<https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#> <https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#> <https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#> [mailto:someone@yoursite.com](mailto:someone@yoursite.com)

![SAP](https://googleads.g.doubleclick.net/pagead/viewthroughconversion/960101754/?value=0&guid=ON&script=0) 

![](https://www.facebook.com/tr?id=199270410761059&ev=PageView&noscript=1)

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#blogposting",
  "@type" : "BlogPosting",
  "about" : [ {
    "@type" : "Thing",
    "name" : "Learn",
    "sameAs" : "https://en.wikipedia.org/wiki/Learning"
  }, {
    "@type" : "Organization",
    "name" : "SAP",
    "sameAs" : "https://en.wikipedia.org/wiki/SAP_AG"
  }, {
    "@type" : "Thing",
    "name" : "report",
    "sameAs" : "https://en.wikipedia.org/wiki/Report"
  }, {
    "@type" : "Thing",
    "name" : "construction industry",
    "sameAs" : "https://en.wikipedia.org/wiki/Construction"
  }, {
    "@type" : "Thing",
    "name" : "Construction",
    "sameAs" : "https://en.wikipedia.org/wiki/Manufacturing"
  }, {
    "@type" : "Thing",
    "name" : "industry",
    "sameAs" : "https://en.wikipedia.org/wiki/Industry_(economics)"
  } ],
  "author" : {
    "@id" : "https://www.sapbwconsulting.com/authors/victor-ayers#person"
  },
  "dateModified" : "2024-10-03",
  "datePublished" : "2024-10-03",
  "description" : "This blog provides a detailed tutorial on calculating the number of days in a selected period using an SAP BW report.",
  "headline" : "How to Calculate the Days in a Selected Period SAP BW Report",
  "inLanguage" : "en",
  "mainEntityOfPage" : {
    "@id" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#webpage"
  },
  "mentions" : [ {
    "@type" : "Thing",
    "name" : "customer",
    "sameAs" : "https://en.wikipedia.org/wiki/Customer"
  }, {
    "@type" : "Thing",
    "name" : "coding",
    "sameAs" : "https://en.wikipedia.org/wiki/Computer_program"
  }, {
    "@type" : "Thing",
    "name" : "personnel",
    "sameAs" : "https://en.wikipedia.org/wiki/Human_resources"
  }, {
    "@type" : "Thing",
    "name" : "metrics",
    "sameAs" : "https://en.wikipedia.org/wiki/Measurement"
  }, {
    "@type" : "Thing",
    "name" : "labor",
    "sameAs" : "https://en.wikipedia.org/wiki/Work_(human_activity)"
  }, {
    "@type" : "Thing",
    "name" : "craft",
    "sameAs" : "https://en.wikipedia.org/wiki/Craft"
  }, {
    "@type" : "Thing",
    "name" : "loaded",
    "sameAs" : "https://en.wikipedia.org/wiki/Dynamic_loading"
  } ],
  "name" : "How to Calculate the Days in a Selected Period SAP BW Report",
  "potentialAction" : {
    "@type" : "ViewAction",
    "name" : "Download the Tutorial on How to Calculate the Number of Days in a Period",
    "target" : {
      "@type" : "EntryPoint",
      "actionPlatform" : [ "http://schema.org/DesktopWebPlatform", "http://schema.org/MobileWebPlatform" ],
      "inLanguage" : "en",
      "urlTemplate" : "https://www.sapbwconsulting.com/how-to-calculate-the-number-of-days-in-a-period"
    }
  },
  "publisher" : {
    "@id" : "https://www.sapbwconsulting.com#organization"
  },
  "url" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.sapbwconsulting.com#website",
  "@type" : "WebSite",
  "name" : "SAP BW Consulting, Inc.",
  "publisher" : {
    "@id" : "https://www.sapbwconsulting.com#organization"
  },
  "url" : "https://www.sapbwconsulting.com"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.sapbwconsulting.com#organization",
  "@type" : "Organization",
  "logo" : {
    "@id" : "https://www.sapbwconsulting.com#logo"
  },
  "name" : "SAP BW Consulting, Inc.",
  "sameAs" : [ "https://www.linkedin.com/company/543163/admin/", "https://www.youtube.com/user/SAPBWConsulting/", "https://twitter.com/Lonniea39", "https://www.facebook.com/SAPBWConsulting" ],
  "url" : "https://www.sapbwconsulting.com"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.sapbwconsulting.com#logo",
  "@type" : "ImageObject",
  "caption" : "SAP BW Consulting, Inc. logo",
  "url" : "https://www.sapbwconsulting.com/hubfs/sapbwconsulting_logo.png"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.sapbwconsulting.com/authors/victor-ayers#person",
  "@type" : "Person",
  "name" : "Victor Ayers",
  "sameAs" : [ "https://www.linkedin.com/in/victorayers" ],
  "url" : "https://www.sapbwconsulting.com/authors/victor-ayers",
  "worksFor" : {
    "@id" : "https://www.sapbwconsulting.com#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#webpage",
  "@type" : "WebPage",
  "breadcrumb" : {
    "@id" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#breadcrumbs"
  },
  "description" : "This blog provides a detailed tutorial on calculating the number of days in a selected period using an SAP BW report.",
  "headline" : "How to Calculate the Days in a Selected Period SAP BW Report",
  "inLanguage" : "en",
  "isPartOf" : {
    "@id" : "https://www.sapbwconsulting.com#website"
  },
  "mainEntity" : {
    "@id" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#blogposting"
  },
  "name" : "How to Calculate the Days in a Selected Period SAP BW Report",
  "url" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report#breadcrumbs",
  "@type" : "BreadcrumbList",
  "itemListElement" : [ {
    "@type" : "ListItem",
    "item" : "https://www.sapbwconsulting.com",
    "name" : "Home",
    "position" : 1
  }, {
    "@type" : "ListItem",
    "item" : "https://www.sapbwconsulting.com/blog",
    "name" : "Blog",
    "position" : 2
  }, {
    "@type" : "ListItem",
    "item" : "https://www.sapbwconsulting.com/blog/how-to-calculate-the-days-in-a-selected-period-sap-bw-report",
    "name" : "How to Calculate the Days in a Selected Period SAP BW Report",
    "position" : 3
  } ]
}
```