Forum Discussion
Ranking measure with Table variable
- 5 years ago
Hi sqlguru448 ,
Be aware that making a summarizaition of a full table will bring for sure performance issues, in your case you are using the FACT table that I assume have a huge number of data so be aware of that.
Try the following code:
Measure = var temp_table = FILTER ( SUMMARIZE ( ALLSELECTED ( Customer[Name] ); Customer[Name]; "Total_Sales"; [Sales Amount] ); [Sales Amount] > 0 ) var Ranking = RANKX(temp_table; [Sales Amount]) RETURN RankingThen filter out all rankings above 10.
Hi sqlguru448 ,
Be aware that making a summarizaition of a full table will bring for sure performance issues, in your case you are using the FACT table that I assume have a huge number of data so be aware of that.
Try the following code:
Measure =
var temp_table =
FILTER (
SUMMARIZE (
ALLSELECTED ( Customer[Name] );
Customer[Name];
"Total_Sales"; [Sales Amount]
);
[Sales Amount] > 0
)
var Ranking = RANKX(temp_table; [Sales Amount])
RETURN
Ranking
Then filter out all rankings above 10.
Thank you this gave me an idea to modify my dax.
- MFelix5 years agoSuper User
Hi sqlguru448 ,
Glad I could point out in the correct direction, I made the measure with only a few lines of data so it could work incorrectly on a bigger scale.
Always remenber that FILTERING a full table will have a very big impact on performance, you should always filter on the minimum amount of columns needed for your calculations and your context needs.