Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
I want to show top 20 customers datails & the other customers one row as attached
Solved! Go to Solution.
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
In my sample, I described top 5 but I hope you can make it to show top 20 in your sample.
Please check the below picture and the attached pbix file.
WINDOW function (DAX) - DAX | Microsoft Learn
Top 5 and others: =
VAR _topN = 5
VAR _topNlist =
WINDOW (
1,
ABS,
_topN,
ABS,
ALL ( customer[customer] ),
ORDERBY ( CALCULATE ( SUM ( sales[sales] ) ), DESC )
)
VAR _topNsales =
CALCULATE ( SUM ( sales[sales] ), _topNlist )
VAR _topNsaleskeepfilter =
CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( _topNlist ) )
VAR _allsales =
CALCULATE ( SUM ( sales[sales] ), REMOVEFILTERS ( customer[customer] ) )
VAR _othersales = _allsales - _topNsales
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( category[category] ) = "others", IF ( NOT HASONEVALUE ( customer[customer] ), _othersales ),
SELECTEDVALUE ( category[category] ) = "top_N", _topNsaleskeepfilter,
_allsales
)
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
In my sample, I described top 5 but I hope you can make it to show top 20 in your sample.
Please check the below picture and the attached pbix file.
WINDOW function (DAX) - DAX | Microsoft Learn
Top 5 and others: =
VAR _topN = 5
VAR _topNlist =
WINDOW (
1,
ABS,
_topN,
ABS,
ALL ( customer[customer] ),
ORDERBY ( CALCULATE ( SUM ( sales[sales] ) ), DESC )
)
VAR _topNsales =
CALCULATE ( SUM ( sales[sales] ), _topNlist )
VAR _topNsaleskeepfilter =
CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( _topNlist ) )
VAR _allsales =
CALCULATE ( SUM ( sales[sales] ), REMOVEFILTERS ( customer[customer] ) )
VAR _othersales = _allsales - _topNsales
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( category[category] ) = "others", IF ( NOT HASONEVALUE ( customer[customer] ), _othersales ),
SELECTEDVALUE ( category[category] ) = "top_N", _topNsaleskeepfilter,
_allsales
)
| User | Count |
|---|---|
| 49 | |
| 37 | |
| 33 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 132 | |
| 99 | |
| 56 | |
| 37 | |
| 37 |