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

Calculation of running total with conditions

Hi all,
I am in need of experts help here.

I want to build a measure for running total balance.
But I have conditions here.
I want that if the running total is less then 150,000 it will show me 150,000
and I want that if it excceds 800,000 it will stop there and show me only 800,000
And here is the problem.
I Made the Running total calculation but I can't find a way to cause the calculation to "delete" all previous calculations and start it over from 150,000 or 800,000.

Here is a how this should look
It starts here with180,000 but it dosent matter. Lets say it starts with 0
Capture.PNG

 



Any help?

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,

Cumm Sales =

var _1 = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))

return 

Switch true() ,

_1 <= 150000, 150000,

_1 >= 800000, 800000,

_1

)

Anonymous
Not applicable

Hi,

This doesn't work
In my example above in March your solution will give me  -573,543 +30,776 +716,253 = 173,486
And as it above then 150000 and less then 800000 the result will be 173,486

But as you can see the result should be  897,029

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.