Hello @Unni,
Also there were quite a few issues as well with regards to the “Sales Rank” measure that you had written and the fields that you had dragged inside the Matrix visual.
So firstly, you had dragged the “Date” field from your Date table and from that hierarchy you deleted the “Date”, “Month” and “Quarter” levels and retained the “Year” level. The first step itself was not correctly followed here. You got to mark your “Date” field as a “Date Table” rather than using it as a hierarchy. You can directly make use of “Year” field instead rather than following the former approach.
Once this is done, you’ll also have to correct your “Sales Rank” measure. The measure that you’ve written is firstly, for the “Year” context only and that too not correct. Below is the measure for the “Yearly Sales Rank” provided for the reference -
Yearly Sales Rank =
RANKX(
ALL( Dates[Year] ) ,
[Total Sales] , ,
DESC )
But based on this measure you’ll not be able to evaluate the results correctly for the Customer Sales at individual Year level. For that you’ll have to insert the context of Customers inside your measure. Below is the revised measure of the Ranking provided for the reference -
Ranking =
IF( ISINSCOPE( 'Customer Data'[Customer Names] ) ,
IF( ISBLANK( [Total Sales] ) ,
BLANK() ,
RANKX(
ALL( 'Customer Data'[Customer Names] ) ,
[Total Sales] , ,
DESC ) ) ,
BLANK() )
Once this measure is written, then by following the steps which were suggested above in the previous post. Now, you’ll be able to conditionally format them based on Ranking. Below is the screenshot of the final results provided for the reference -
(Note:- In this case, the color scheme for “Minimum Value” will be set to darker since lower the rank, higher the sales value and vice-versa)
I’m also attaching the working of the PBIX file as well as providing few of the links below of the videos on the “Ranking” topic from our EDNA channel for the reference purposes.
The Page One in the PBIX file shows “Conditional Formatting By Total Sales” whereas Page Two shows “Conditional Formatting By Ranking”.
You can go with either of the scenario that suits your business circumstances or analysis.
Hoping you find this useful and meets your requirements that you’ve been looking for.
Thanks and Warm Regards,
Harsh
Forecasting - Harsh v2.pbix (536.5 KB)