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
Solariz9
Regular Visitor

cumulative measure yields incorrect values when slicer applied (data source and pbi attached)

I have a meansure to caculate cumulative count of records based on the column "DeltaMonth" as below

 

K_TOTAL = 
VAR MX = MAX(Data[DeltaMonth])
RETURN CALCULATE(
	DISTINCTCOUNT(Data[Number]),
	FILTER(
		ALL(Data[DeltaMonth]),
		Data[DeltaMonth] <= MX
	)
)

 

It works quite well, yielding cumulative figures

Solariz9_0-1722391417734.png

 

 

But when I apply the slicer to both "Severity" & "Edition", the cumulative measure doesn't work properly anymore:

 

 

Solariz9_1-1722391431187.png

 

Solariz9_2-1722391444629.png

 

 

Can anyone help to figure this out? The data source can be found in the attached xlsx table.

 The : PBI file 

 The data source

 

 

 

1 ACCEPTED SOLUTION

Hi @Solariz9 ,

You can update the formula of measure [K_TOTAL] as below:

K_TOTAL = 
VAR MX =
    SELECTEDVALUE ( Data[DeltaMonth] )
VAR _edition =
    SELECTEDVALUE ( 'Data'[Edition] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Data[Number] ),
        FILTER (
            ALLSELECTED ( Data ),
            'Data'[Edition] = _edition
                && Data[DeltaMonth] <= MX
        ),
        REMOVEFILTERS ( 'Data'[DeltaMonth] )
    )

vyiruanmsft_0-1722588982320.png

Best Regards

Community Support Team _ Rena
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

6 REPLIES 6
rajendraongole1
Super User
Super User

Hi @Solariz9 - you can use the REMOVEFILTERS function instead of ALL to retain the other slicers, use the below measure

K_TOTAL =
VAR MX = MAX(Data[DeltaMonth])
RETURN
CALCULATE(
DISTINCTCOUNT(Data[Number]),
FILTER(
REMOVEFILTERS(Data[DeltaMonth]),
Data[DeltaMonth] <= MX
)
)

 

Hope it works

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 ,

 

It seems the syntax is wrong if just replace ALL with REMOVEFILTERS. See this screen copy:

Solariz9_0-1722479647923.png

 

Hi @Solariz9 ,

I can't open your shared pbix file and got the file corrupted error. I created a sample pbix file(see the attachment) base on shared excel file. You can update the formula of measure [K_TOTAL] as below to get the expected result...

K_TOTAL = 
VAR MX =
    MAX ( Data[DeltaMonth] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Data[Number] ),
        FILTER ( ALLSELECTED ( Data ), Data[DeltaMonth] <= MX ),
        REMOVEFILTERS ( 'Data'[DeltaMonth] )
    )

vyiruanmsft_1-1722502610104.png

Best Regards

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

Dear @v-yiruan-msft ,

 

Thanks so much for your solution. It's approaching to the final destination, but still not perfect.

 

If keep YYY2401 select, it's working pretty well. But if we select 2 Editions or more, you can see all of Editions are mixed together. As below screen copy. Now I have to doubt, there's something wrong in Power BI ...

 

Solariz9_0-1722578036040.png

 

I uploaded the compressed pbix file as this, please try if you can open it.

Hi @Solariz9 ,

You can update the formula of measure [K_TOTAL] as below:

K_TOTAL = 
VAR MX =
    SELECTEDVALUE ( Data[DeltaMonth] )
VAR _edition =
    SELECTEDVALUE ( 'Data'[Edition] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Data[Number] ),
        FILTER (
            ALLSELECTED ( Data ),
            'Data'[Edition] = _edition
                && Data[DeltaMonth] <= MX
        ),
        REMOVEFILTERS ( 'Data'[DeltaMonth] )
    )

vyiruanmsft_0-1722588982320.png

Best Regards

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

hi @v-yiruan-msft 

 

Thank you so much! the issue is now perfectly solved.

 

Can you please explain more? why Edition has to be put as SELECTEDVALUE? Why there's no need to put Severity as SELECTEDVALUE? Thanks in advance!

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!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.