Forum Discussion
Customized Total Row (sum of top 4) in table Visualization
I am looking to get a customized value in the total row for table visualization in Power BI.
I would like the total to be the sum of the top 4 rows only.
Below is a screenshot of the data table and result that I am trying to achieve.
Thanks in advance for your help !
- Anonymous2 years ago
Hi Kaymen ,
You can try the DAX below:Top4_Sum = SUMX(TOPN(4, ALL('Table'[Points]), 'Table'[Points], DESC), 'Table'[Points])The DAX first sorts the values of the points column from highest to lowest, and then calculates the sum of the first 4 columns.
The results are shown in the figure below:Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- AmiraBedh
Super User
What is your criteria for the TOP 4 rows ?
- KaymenNew Member
The top 4 ranked by the points value.
- AnonymousNot applicable
Hi Kaymen ,
You can try the DAX below:Top4_Sum = SUMX(TOPN(4, ALL('Table'[Points]), 'Table'[Points], DESC), 'Table'[Points])The DAX first sorts the values of the points column from highest to lowest, and then calculates the sum of the first 4 columns.
The results are shown in the figure below:Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.