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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Total difference from previous date

Hi all,

 

I have 2 columns, one with values and the other with dates. The dates are non continous , for e.g. 10/10/2019, 12/10/2019, 20/10/2019 etc

 

I need to be able to get the difference between the sum of all the values from each date and previous date.

 

Is there a way to accomplish this?

 

I already have a column with the previous date gotten with this formula: 

Predate = CALCULATE (
    MAX (WeeklyOutstanding[Week] ), FILTER ( WeeklyOutstanding, WeeklyOutstanding[Week] < EARLIER ( WeeklyOutstanding[Week] ) ) )

 

Help would be greatly appreciated 

1 ACCEPTED SOLUTION
richbenmintz
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

You can try measure like the following

 

 

Delta From Previous = 
    var prev_date = CALCULATE(MAX('WeeklyOutstanding'[Week]), FILTER(all('WeeklyOutstanding'), 'WeeklyOutstanding'[Week] < SELECTEDVALUE('WeeklyOutstanding'[Week])))
    return
    sum('WeeklyOutstanding'[amount]) - CALCULATE(SUM('WeeklyOutstanding'[amount]), FILTER(ALL('WeeklyOutstanding'), 'WeeklyOutstanding'[Week] = prev_date))

 

 

Hope that Helps

Richard



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


View solution in original post

3 REPLIES 3
Anonymous
Not applicable

This worked great! Thank you!

 

The  only issue now is that somehow it only works with the full data, whenever I use filters its gives the wrong amounts. Do you know why?

It is removing the filter context with

all('WeeklyOutstanding'[Week])

, you may need to change that be just 

ALL('WeeklyOutstanding')

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


richbenmintz
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

You can try measure like the following

 

 

Delta From Previous = 
    var prev_date = CALCULATE(MAX('WeeklyOutstanding'[Week]), FILTER(all('WeeklyOutstanding'), 'WeeklyOutstanding'[Week] < SELECTEDVALUE('WeeklyOutstanding'[Week])))
    return
    sum('WeeklyOutstanding'[amount]) - CALCULATE(SUM('WeeklyOutstanding'[amount]), FILTER(ALL('WeeklyOutstanding'), 'WeeklyOutstanding'[Week] = prev_date))

 

 

Hope that Helps

Richard



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.