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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Gangasaniravi
Helper I
Helper I

Top N customers by year in one color and that N customers data in other years

 If a customer is top customer in a particular financial period (say FY20) but its not the top ones in FY19 , we need to display  value of it in FY19

if they select top 6 in parameter need to display top 6 is in one color and other values in different color

IMG_2239.jpeg

 Output

IMG_2240.jpeg

 Please help me to get this. I am able to get top 2 customers each year but not able to get other years data for same customer

 

regards,

ravi

 

3 REPLIES 3
Gangasaniravi
Helper I
Helper I

Any pointers much appreciate 

Gangasaniravi
Helper I
Helper I

And Top should be based on user selection in parameter 

Nankaina
Helper I
Helper I

Hi Ravi,

 

It seems a similar problem was asked about here, so credit ought to go to @VahidDM for this answer.

 

Modifying the solution for your data, we add a column:

 

Rank by Year = 
RANKX (
    FILTER ( ALL ( 'ExampleTable' ), [year] = EARLIER ( 'ExampleTable'[year]) ),
    [sale],
    ,
    DESC,
    DENSE
)

 

Then, since you're only interested in the Top 2, we can define another column:

 

Color = if(ExampleTable[Rank by Year]<=2, "Green", "Yellow")

 

From here, the Matrix element will do the rest of the work. I've set it up as follows:

Nankaina_4-1704740529828.png

 

 

Nankaina_1-1704740339514.png

 

Nankaina_2-1704740402726.png

 

And the result is as you requested (if not my prettiest work):

Nankaina_5-1704740554314.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.