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.
Hello,
I want to calculate cumulative sum for a specific date range. It should also have the total sum until the start date.
Example table:
Now if I want to see the cumulative sum for May to September, it should be something like this:
How can I achieve this? Thank you
Solved! Go to Solution.
Hi @Zahin ,
I have created a simple sample, please refer to my pbix file to see if it helps you.
Create a meausre.
Measure =
VAR _max =
MAXX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
VAR _min =
MINX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
VAR _re =
CALCULATE (
SUM ( 'Table'[amount] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month] <= MAX ( 'Table'[Month] ) )
)
RETURN
IF (
MAX ( 'Table'[Month] ) >= _min
&& MAX ( 'Table'[Month] ) <= _max,
_re,
BLANK ()
)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Zahin ,
I have created a simple sample, please refer to my pbix file to see if it helps you.
Create a meausre.
Measure =
VAR _max =
MAXX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
VAR _min =
MINX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
VAR _re =
CALCULATE (
SUM ( 'Table'[amount] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month] <= MAX ( 'Table'[Month] ) )
)
RETURN
IF (
MAX ( 'Table'[Month] ) >= _min
&& MAX ( 'Table'[Month] ) <= _max,
_re,
BLANK ()
)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Zahin , you need measure like
values For beginning
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])))
Only for selected range
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))
Same you can do with window function
Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
Running Total/ Cumulative: https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=41
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 |
---|---|
107 | |
97 | |
75 | |
65 | |
53 |
User | Count |
---|---|
144 | |
103 | |
98 | |
85 | |
64 |