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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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