Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors