Hello @BINavPete,
Thank You for posting your query onto the Forum.
I’m providing two solutions to achieve the results based on the condition that you’ve specified. Below are the measures alongwith the screenshot of the final results provided for the reference -
1). Ranking Results Based On Tabular Form -
Tabular Ranking - Harsh =
IF( ISBLANK( [Total Sales - PBT] ) ,
BLANK() ,
IF( ISINSCOPE( Companies[BusinessUnit] ) || ISINSCOPE( Depts[DeptName] ) ,
RANKX(
CROSSJOIN(
ALL( Companies[BusinessUnit] ) ,
ALL( Depts[DeptName] ) ) ,
[Total Sales - PBT] , ,
DESC ) ) )
2). Ranking Results Based On Hierarchial Form -
Hierarchial Ranking - Harsh =
VAR _Business_Unit_Ranking =
SUMX(
ADDCOLUMNS(
SUMMARIZE(
Data ,
Companies[BusinessUnit] ) ,
"@Business_Unit_Ranking" ,
RANKX( ALL( Companies[BusinessUnit] ) , [Total Sales - PBT] , , DESC ) ) ,
[@Business_Unit_Ranking] )
VAR _Department_Name_Ranking =
SUMX(
ADDCOLUMNS(
SUMMARIZE(
Data ,
Depts[DeptName] ) ,
"@Department_Name_Ranking" ,
RANKX( ALL( Depts[DeptName] ) , [Total Sales - PBT] , , DESC ) ) ,
[@Department_Name_Ranking] )
VAR _Results =
SWITCH( TRUE() ,
ISINSCOPE( Depts[DeptName] ) , _Department_Name_Ranking ,
ISINSCOPE( Companies[BusinessUnit] ) , _Business_Unit_Ranking ,
BLANK() )
RETURN
_Results
I’m also attaching the working of the PBIX file for the reference purposes.
Hoping you find this useful and meets your requirements that you’ve been looking for.
Important Note: In the case of ties, I’m providing the links of the YouTube videos which are being created by our Enterprise DNA Experts. You can implement that technique as per your requirements in your scenario.
Thanks and Warm Regards,
Harsh
Ranking - Harsh.pbix (75.3 KB)