cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
StephenF
Responsive Resident
Responsive Resident

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors