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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Black_magic100
Helper III
Helper III

Formatting top 3 largest bars in bar chart?

I have a very simple bar chart that uses a calendar date table for the x axis and a count of a primary key for the y axis.  I would like to create a measure that would allow me to color the top 3 largest bars blue and leave everything else grey.  Can anybody help me out?  I know it is possible to select max, but can you write a measure to select top 3 max?

5 REPLIES 5
Zubair_Muhammad
Community Champion
Community Champion

@Black_magic100

 

Try a Measure on these lines

 

Measure =
IF (
    SELECTEDVALUE ( 'Calendar'[Date] )
        IN TOPN ( 3, ALL ( 'Calendar'[Date] ), [Primary Keys], DESC ),
    "#0000FF",
    "#909497"
)

Regards
Zubair

Please try my custom visuals

I created a measure to sum my column as a whole, but even then I am not sure how your measure is suppose to work.  A measure can't be a value in a bar chart, it defaults to tooltip?

@Black_magic100

 

Please see the attached file

 

 


Regards
Zubair

Please try my custom visuals

Ahh there is the issue.  You are selecting the top 3 values of the table.  I need the top 3 values (counts) of the visual itself.

 

The visual might have 3 bars or 31 (it is a month long) and it can be adjusted by month and year.  So If I select February 2017 I would want the top 3 bars to be highlighted

I am confused what primary keys is suppose to be?  It expects a measure, not a column

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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