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
01_RAF_01
Frequent Visitor

Running total with measure

Hi, im not sure if this is possible so hope someone can give some answer on it. 

I have a measure and it results in this:
1.PNG

2.PNG

 

 

However i need the running total / cummulate the amounts... in this case : 

 

days after today 44,88,132,176, etc etc ...


I thought by using this part i should be able to cummulate all the previous numbers :
"DIM_Dates[Date] >= maxdate,

ALL(DIM_Dates)))"

Would appreciate some help if its possible to calculate running totals based on measures, like i posted above instead of "sum" etc..
2 REPLIES 2
mahoneypat
Employee
Employee

Your variable MA is fixed once calculated, so putting it inside the CALCULATE doens't get you new numbers.  Try deleting that variable and replace MA with whatever your desired calculation is (e.g., SUM of a column?) in your Return. 

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


I tried that but also doesnt get me the result. 

Maybe better to decribe the total calculations/measures: 

1) I have a measure that counts the nrs of rows in a (filtered) table. (measure 1)

measure1= 
CALCULATE( COUNT('abc'[def]),
FILTER('abc',
NOT( 'abc'[ghi]= "1" && 'abc'[jkl] = "2" ) ))


2) from that measure i calculate the 30days MA (measure 2)

measure2=

VAR Datum = MAX(DIM_Dates[Date])
RETURN
If(Datum > TODAY(), BLANK(), CALCULATE(
AVERAGEX(
DATESINPERIOD(DIM_Dates[Date],
MAX(DIM_Dates[Date]),
-30, DAY), CALCULATE([measure1],DIM_Dates[Werkdag]=1)),DIM_Dates[Date]=TODAY()) )

2) from that measure i want to have the running totals starting today, just like here https://www.sqlbi.com/articles/computing-running-totals-in-dax/  (Runningtotal)

Runningtotal= 

VAR maxdate = MAX(DIM_Dates[Date])
return
CALCULATE(
[measure2],
DIM_Dates[Date] <= maxdate,
ALL(DIM_Dates )))

1.PNG



still getting the same number instead of it cumulating.... 

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.

Top Solution Authors