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
sam_hoccane
Helper I
Helper I

Cumulative total with a measure

Hello Community, 

 

Can you please help me with following problem. 

I have created a measure that is adding new rows to table with condition.  I want to use that measure to calculate cumulative total. 

 

Here is created measure : 

Measure Value =
IF(MAX('table'[Value])<>BLANK(),MAX('table'[Value]),MAXX(FILTER(ALL('table'),'table'[Year Month]=MAXX(ALL('table'),'table'[Year Month])),'table'[Value])*POWER(1.2,DATEDIFF(MAXX(ALL('table'),'table'[Year Month]),MAX('Table (2)'[Year Month]),MONTH)))
 
Using above measure I want to calculate cummulative total.  I tried with following measure but it is not working properly. 
 
Cummulative Total = SUMX(FILTER (ALLSELECTED('table') , 'table'[Year Month]<=MAX('table'[Year Month] ) ),[Measure Value] )
 
I have attached data here:
 
Thankyou in anticipation!
Sam

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @sam_hoccane 

Please try formula like:

Cummulative Total = 
VAR tab =
    ADDCOLUMNS ( ALLSELECTED ( 'Table (2)' ), "Measure Value", [Measure Value] )
RETURN
    SUMX (
        FILTER ( tab, 'Table (2)'[Year Month] <= MAX ( 'Table (2)'[Year Month] ) ),
        [Measure Value]
    )

veasonfmsft_0-1656670001439.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @sam_hoccane 

Please try formula like:

Cummulative Total = 
VAR tab =
    ADDCOLUMNS ( ALLSELECTED ( 'Table (2)' ), "Measure Value", [Measure Value] )
RETURN
    SUMX (
        FILTER ( tab, 'Table (2)'[Year Month] <= MAX ( 'Table (2)'[Year Month] ) ),
        [Measure Value]
    )

veasonfmsft_0-1656670001439.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@sam_hoccane , Try like

 

Cummulative Total = calculate(SUMX( values('table'[Year Month]),[Measure Value] )
,FILTER (ALLSELECTED('table') , 'table'[Year Month]<=MAX('table'[Year Month] )))

better to use a date table 

 

Cummulative Total = calculate(SUMX( values('Date'[Year Month]),[Measure Value] )
,FILTER (ALLSELECTED('Date') , 'Date'[Year Month]<=MAX('Date'[Year Month] )))

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