Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculating difference against the values of previous period

Hi,

 

The following is a sample of my dataset and I would like to derive how much time I have worked each day.

 

powerbi_data_sample.JPG

In the above data, note that the 3rd column is an incremental value.

 

  1. On 1st Aug, I have logged 1 hour in task A, 2 hours in task B and 4 hours in task C
  2. On 2nd Aug, I have logged 2 hours in task A, 2 hours in task B and 0 hours in task C
  3. On 3rd Aug, I have logged 0 hours in task A, 1 hours in task B and 2 hours in task C

I'm able to create a report that shows incremental data everyday but what I'm looking for is to show data that I logged each day. Like:

 

  • 2019-08-01: 7 hrs
  • 2019-08-02: 4 hrs
  • 2019-08-03: 3 hrs

Please advise.

5 REPLIES 5
Anonymous
Not applicable

HI @Anonymous ,

 

Based on your sample data,

 

Here is the measure you can use:

 

Hrs total for Task = 
CALCULATE(SUM('Table (2)'[Hrs]), ALLSELECTED('Table (2)'[Task]))

Let me know if this works.

 

Thanks,

Tejaswi

Anonymous
Not applicable

It's still the same, here's the output:

 

powerbi_report_sample.JPG

Anonymous
Not applicable

Hi @Anonymous ,

 

Can you be more specific with your requriements?

How did you get this data from your sample data? ( what is the calculation you are using to get this?)

 

Capture3.PNG

Thanks,

Tejaswi

 

Anonymous
Not applicable

Hi @Anonymous ,

 

My requirement is to report data like this, and need help!

Capture3.PNG

 

As you see in my previous post, I'm only able to get accumulated data (7, 11 and 14). 

 

Thanks!

Anonymous
Not applicable

Hi @Anonymous ,

 

Create a new index columns thru edit queries

Add these two DAX columns  and give a try.

1. to get the sum by by dates

Total  Hours bY category = 
SUMX(FILTER(ALL('Table (2)'),[Date]=EARLIER('Table (2)'[Date])),[Hrs])

2. Subtract from preious row.

Column 3 = VAR Index = 'Table (2)'[Index]
VAR Reference = 'Table (2)'[Task]
VAR Prevhrs =
    CALCULATE (
        FIRSTNONBLANK ( 'Table (2)'[Total  Hours bY category], TRUE () ),
        FILTER ( 'Table (2)', 'Table (2)'[Index] = Index - 1 && 'Table (2)'[Task] = Reference )
    )
RETURN
    IF (
        ISBLANK ( Prevhrs ),
        'Table (2)'[Total  Hours bY category],
        'Table (2)'[Total  Hours bY category] - Prevhrs
    )
let me know if this works

Thanks,

Tejaswi

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.