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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Petepete
Regular Visitor

Dynamic (slicer-dependent) ranking of time series

Hi All, after a long search I couldn't find the right solution to my problem.

I got this (simplified) data (unpivoted time series):

Petepete_0-1627915529621.png

"Day" is the time index (x-axis), "Value" is the timeseries (y-axis), while "Cat" are the categories (can imagine a stacked area chart, or a line chart)

My original problem is having a huge number of categories, hence need to rank a plot first x time series.

Also, I wanna rank by the sum of abs(value) along the whole time span, of every category

 

"Filter" represents hypotetically multiple columns that are spawned into slicers - so that ranking shall change dynamically.

 

I tried a measure like this:

Measure = RANKX (
SUMMARIZE ( ALL ( 'Table' ), 'Table'[Cat], "@ABS_VALUE", SUM ( 'Table'[ABS_VALUE] ) ),
[@ABS_VALUE],
SUM ( 'Table'[ABS_VALUE] ),
DESC
)

 

which stops working fine the moment the time index is popped into the table / linechart / stacked chart

Any ideas peeps?

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Petepete ;

I can try to modify it according to your measure, but I don't understand how you want to sort it. I remember that only sort it according to column, maybe you can make it clearer according to the picture.

Measure =
RANKX (
    ALLSELECTED ( 'Table' ),
    CALCULATE (
        CALCULATE (
            SUM ( [ABS_VALUE] ),
            FILTER ( ALLSELECTED ( 'Table' ), [Cat] = MAX ( [Cat] ) )
        )
    ),
    ,
    DESC,
    DENSE
)

The final output is shown below: 

vyalanwumsft_0-1628063318916.pngvyalanwumsft_1-1628063318918.png

Best Regards,

Community Support Team_ Yalan Wu

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

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Petepete ;

I can try to modify it according to your measure, but I don't understand how you want to sort it. I remember that only sort it according to column, maybe you can make it clearer according to the picture.

Measure =
RANKX (
    ALLSELECTED ( 'Table' ),
    CALCULATE (
        CALCULATE (
            SUM ( [ABS_VALUE] ),
            FILTER ( ALLSELECTED ( 'Table' ), [Cat] = MAX ( [Cat] ) )
        )
    ),
    ,
    DESC,
    DENSE
)

The final output is shown below: 

vyalanwumsft_0-1628063318916.pngvyalanwumsft_1-1628063318918.png

Best Regards,

Community Support Team_ Yalan Wu

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

That is excellent!

You got what I meant, Many many thanks a million 🙂

Vera_33
Resident Rockstar
Resident Rockstar

Hi @Petepete 

 

You can try ALLSELECTED, but it might not work as I don't have enough context of your data / visual (other filters)

Measure = RANKX (
SUMMARIZE ( ALLSELECTED ( 'Table' ), 'Table'[Cat], "@ABS_VALUE", SUM ( 'Table'[ABS_VALUE] ) ),
[@ABS_VALUE],
SUM ( 'Table'[ABS_VALUE] ),
DESC
)

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.