cancel
Showing results for
Did you mean:
Regular Visitor

## Cumulative measure based on dynamic measure – Slicer problem

Hi, need some help with the following:

The Visual

The visual shows the ranking of items based on the last time they were sold ('worst' to 'best')

The ‘PartID’ field is a column from the material table – ‘Products’. The other three fields are measures.

The ‘Cumulative Gap’ measure is a running total of the ‘Gap From Last Transaction’ measure.

Without using a slicer, the visual shows correct results for all the fields.

The problem

When adding a slicer, and adding ALLSELECTED to the measures, the ‘Gap From Last Transaction’ results are correct but the ‘Cumulative Gap’ shows the whole total in each cell instead of running total (left image)

If I remove ALLSELECTED from the measures, the ‘Cumulative Gap’ works as expected, but the results of the ‘Gap From Last Transaction’ are incorrect (obviously, because I removed ALLSELECTED) (right image).

these are the measures (i used index column similar to date column):

Gap From Last Transaction =

VAR MaxIndex = MAX ( Sales [ Index ] )

VAR LastBuy = CALCULATE( MAX ( Sales [ Index] ) ,

FILTER (ALLSELECTED (Sales) ,

Sales [ PartID ] =  FIRSTNONBLANK( Products [ PartID ] ,  Products [ PartID ] ) ) )

RETURN

Total Gaps =  SUMX ( Products , [ Gap From Last Transaction ] )

Cumulative Gap =

CALCULATE ( [ Total Gaps ] ,

FILTER (

ALLSELECTED( Products [ PartID ] ), SUMX ( Products , [ Total Gaps ] )  <= [ Total Gaps ] ))

Rank =

CALCULATE ( RANKX ( ALLSELECTED ( Products [ PartID] ) ,[Gap From Last Transaction ] ,,DESC ) )

Tanks for the help.

1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

## Re: Cumulative measure based on dynamic measure – Slicer problem

@dpbi

Sample File

Regards

Victor

Lima - Peru

Lima - Peru

Proud to be a Datanaut!

3 REPLIES 3
Super Contributor

## Re: Cumulative measure based on dynamic measure – Slicer problem

@dpbi

Sample File

Regards

Victor

Lima - Peru

Lima - Peru

Proud to be a Datanaut!

Regular Visitor

## Re: Cumulative measure based on dynamic measure – Slicer problem

@Vvelarde

Hi Victor.

Many thanks for your fast response and sample file.

Definitely, one of the best features of Power Bi Desktop is this forum.

Best Regards,

Dan

Highlighted
Super Contributor

## Re: Cumulative measure based on dynamic measure – Slicer problem

@dpbi

Thank you, your very clear description of the scenario helped me a lot.

Regards

Victor

Lima - Peru

Proud to be a Datanaut!

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 288 members 2,953 guests
Recent signins: