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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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])))

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])))

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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