Reply
razan_5r5
Frequent Visitor

Top 5 diagnosis

map.PNG

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

Misunderstood requirement. 

To see top 5 diagnosis list as a tooltip on map you need a measure like:

Top5 = 
VAR RankingContext = VALUES ( 'Sheet_4_data (6)'[Diagnosis Code] )
VAR Top5Diagnosis = 
CALCULATETABLE (
    VALUES( 'Sheet_4_data (6)'[Diagnosis Code] ),
    TOPN ( 5, ALL ( 'Sheet_4_data (6)'[Diagnosis Code] ), 'Sheet_4_data (6)'[diagnosis_count] ),
    RankingContext
)

RETURN CONCATENATEX(Top5Diagnosis, 'Sheet_4_data (6)'[Diagnosis Code], ", ")


Which can be dropped into the tooltip section.



Ben Dobbs

LinkedIn | Twitter | Blog

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

View solution in original post

5 REPLIES 5
razan_5r5
Frequent Visitor

thank you so much 

 

but if i publish this dashboard in the command center it will not show the top 5 diagnosis 

any recommandations?

razan_5r5
Frequent Visitor

sorry can you try the code 

i did not work with me

bcdobbs
Community Champion
Community Champion

Hi,
I would do the following:

1) Split geography columns off into a separate dimension table:

Geography = 
SUMMARIZE(
    SheetData,
    SheetData[District],
    SheetData[City],
    SheetData[Region],
    SheetData[latitude ],
    SheetData[Longitude]
)

Relate this back to your main table on the District column.

(Ideally split the whole table off into a star schema as it keeps the DAX much simpler: Importance of Star Schemas ) in Power Bi  

 

2) Swap all visuals to use columsn from this table.

 

3) Create a ranking measure in your main (fact) table:

District Rank = 
    RANKX ( 
        ALLSELECTED( Geography ),
        [Diagnosis Count]
    )

4) In the visual filter of for your map put this measure and set it so it is less than or equal to 5.

bcdobbs_0-1640537382865.png

 



Ben Dobbs

LinkedIn | Twitter | Blog

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

Misunderstood requirement. 

To see top 5 diagnosis list as a tooltip on map you need a measure like:

Top5 = 
VAR RankingContext = VALUES ( 'Sheet_4_data (6)'[Diagnosis Code] )
VAR Top5Diagnosis = 
CALCULATETABLE (
    VALUES( 'Sheet_4_data (6)'[Diagnosis Code] ),
    TOPN ( 5, ALL ( 'Sheet_4_data (6)'[Diagnosis Code] ), 'Sheet_4_data (6)'[diagnosis_count] ),
    RankingContext
)

RETURN CONCATENATEX(Top5Diagnosis, 'Sheet_4_data (6)'[Diagnosis Code], ", ")


Which can be dropped into the tooltip section.



Ben Dobbs

LinkedIn | Twitter | Blog

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

Can you supply a demo pbix file?



Ben Dobbs

LinkedIn | Twitter | Blog

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

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)