Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello Community,
I've tried to work this out by myself with IF statements and variables but I can't think of anything anymore. I have a balance column measure that needs to be populated by the sum total of the JBalance[Mutations] chronologically.
The table is sorted on Date and has an index but I can't for the life of me construct it in a way where the output can't be lower than 0 and the measure starts calculating from 0 again. This is what I got right now:
Balance = CALCULATE(SUM('JBalance'[Mutation]),FILTER('JBalance','JBalance'[Index]<=EARLIER('JBalance'[Index])))
I need it to dynamically adjust the FILTER range when it reaches a result of lower than 0. I can make it output a 0 by an IF statement but can't think of a way to update the FILTER to start over from 0 (as in adjust the filter on JBalance'[Index], disregarding the previous rows so the SUM total starts calculating from current row)
Solution output:
Hi @rfigtree
I've adjusted the post you gave us a link to to calculate what @DarkEnergy22 wants. Indeed, this works. I was convinced a formula could not be crafted for this but apparently I was wrong 🙂 Each day something new, it seems.
// So, the first calculated column must be:
[Cumulative Sum] =
var vCurrentDate = T[Date]
return
sumx(
filter( T, T[Date] <= vCurrentDate),
T[Mutation]
)
// The second column will be:
[Cummin of Cumulative Sum] =
var vMin =
minx(
filter( T, T[Date] <= vCurrentDate),
T[Cumulative Sum]
)
return
min( 0, vMin )
// The final column:
[Cumulative Sum Adjusted] =
T[Cumulative Sum] - T[Cummin of Cumulative Sum]
Mate, save yourself grief and calculate this in Power Query. Your formula is recursive by nature and you can forget about calculating this is DAX. Such recursive formulas are not possible in this language. Power Query or the language of the data source is your only chance.
Hello @DarkEnergy22 ,
It's happening because of the balance of the index is less and mutation of the index 39 is more.
Can you provide the data in table format instead of image?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |