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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Cado_one
Resolver III
Resolver III

Cumulative value of a measure

Hello,

 

I face an issue with a measure (called PreviewCumul).

This is the context :

Cado_one_0-1657522072931.png

The [Preview] is a measure corresponding to the [Realized] column if MONTH([Date]) <= 2, else [Provisional] column

Preview = 
VAR MonthCount = 2
RETURN
IF(
    MAX(Dates[MoisNum]) <= MonthCount,
    SUMX(
        'Table1',
        Table1[Realized]
    ),
    SUMX(
        'Table2',
        Table2[Provisional]
    )
)

My problem then concerns the [PreviewCumul] measure that does the running total of [Preview]

PreviewCumul =
CALCULATE(
	[Preview],
	FILTER(
		CALCULATETABLE(
			SUMMARIZE('Dates', 'Dates'[AnnéeMoisTri], 'Dates'[engDate]),
			ALLSELECTED('Dates')
		),
		ISONORAFTER(
			'Dates'[AnnéeMoisTri], MAX('Dates'[AnnéeMoisTri]), DESC,
			'Dates'[engDate], MAX('Dates'[engDate]), DESC
		)
	)
)

As we can see in the table screenshot above, the problem is that as from month number 3 it sums the values of [provisional] only from the beginning of the year instead of summing [Preview] values.

 

Does anyone have an idea of a clean way to solve it ?

Thanks in advance.

Best regards,

Cado

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Cado_one , You need to try measure like

 

calculate(Sumx(Values('Date'[Month Year]), [Preview]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

 

or


calculate(Sumx(Values('Date'[Month Year]), [Preview]),filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Cado_one , You need to try measure like

 

calculate(Sumx(Values('Date'[Month Year]), [Preview]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

 

or


calculate(Sumx(Values('Date'[Month Year]), [Preview]),filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak 

 

The second one is fine, thanks !

 

Cado

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors