cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StephenF
Super User
Super User

Smart narratives second highest spend in a category?

 

Here is the text to get the top spender, how to get the second highest spender?

 

StephenF_0-1652357336617.png

 

 

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @StephenF ,

 

You could create a measure like

top 2 = 
CONCATENATEX (
FILTER (
ALLSELECTED ( 'Table'[ID]),
RANKX (
ALLSELECTED ( 'Table'[ID]),
CALCULATE ( SUM('Table'[Sales]) ),
,
DESC
) <= 2
),
'Table'[ID],
", ",
RANKX (
ALLSELECTED ( 'Table'[ID] ),
CALCULATE ( SUM('Table'[Sales]) ),
,
DESC
)
)

vstephenmsft_0-1652860412843.png

Then you'll get the dynamic top 2.

vstephenmsft_1-1652860447721.png

 

 

Best Regards,

Stephen Tao

 

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

Now, how to get the second highest sale only..

amitchandak
Super User
Super User

@StephenF , I tried a few combinations like 2nd highest, rank 2, Seem like you need to train it to use rank for such a case



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.