Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
My data looks like this:
Is there a way to create a measure for the cumulative sum (last column in the table) that takes into account also opening balance (before January in the table). So what I would need is to sum balance and cumulative balance from previous month. Also, that when I'm using slicer for years, then in 2019 it would take the Dec cumulative balance from 2018.
So far I have this measure:
Cumulative = calculate(sum(Data[AMOUNT]);filter(ALLSELECTED(Data); Data[Month]<=MAX(Data[Month])))
But this doesn't take opening balance into account and when I choose a new year, then it starts cumulating the balances from 0.
Thank you in advance.
Best regards,
Liis
Hi,
You show 2 Tables in your measure but your formula only refers to the Data Table. Please share the actual data layout. Also, the opening balance of 1500 should have some date against it. So please assign some data to that figure. Share data in a format that can be pasted in an Excel file.
I could add January 2018 date to the opening balance as it should be included in January's total. But the data is from the same table, just year is different (I wanted to show that when I use year slicer on date, then it would still calculate correct cumulative).
HI @Anonymous ,
I'd like to suggest you to take a look at following blog about auto-exist filter if you are using same table date field as source of slicer.
I think you need to use variable to store selected and apply all function on table to ignore filter effect:
Measure = VAR selected = MAX ( Table1[Date] ) RETURN CALCULATE ( SUM ( Table1[Amount] ), FILTER ( ALL ( Table1 ), [Date] <= selected ) )
Regards,
Xiaoxin Sheng
This almost worked, but what is still tricky, is that I have an another slicer for different products and in case slicer is on, then it shows cumulative total for all the products (the above data was for one product only).
Is there a way to add this as well in the measure?
Thank you!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
102 | |
84 | |
79 | |
68 |
User | Count |
---|---|
120 | |
110 | |
94 | |
81 | |
77 |