Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi Guys,
Hope you all had anice weekend.
I am currently learning how to make dynamic grouping via support table.
Customer Sales by Group =
CALCULATE( [Total Sales],
FILTER( VALUES( Customers[Customer Names] ),
COUNTROWS(
FILTER( 'Customer Groups',
RANKX( ALL( Customers[Customer Names] ), [Total Sales],,DESC ) > 'Customer Groups'[Min]
&& RANKX( ALL( Customers[Customer Names] ), [Total Sales],, DESC ) <= 'Customer Groups'[Max] ) )
> 0 ))
here is the fomula that i just learnt. So basically i created a new table that has 'Top 5', '5 to 20' and 'the rest' that evaulates the groups.
2 questions.
1. Why does there need be countrows >0 ? does the fomula not work if i dont have the countrows function there?
2. Why do i need all[customer names] in RANKX? if i remove all filters for Customers names by using 'ALL' fuction the total sales returns the same and i won't be able to rank customers by 'Sales Total'?
Thanks in advance for your help.
Cheers,
Solved! Go to Solution.
HI @Dankang,
#1. It is used to ignore result who not suitable for your conditions.(count row with blank table will blank result, power bi will recognize it as zero)
#2. All function is used to break filter effect to let formula calculated on whole table.
Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT
Regards,
Xiaoxin Sheng
Hi Guys,
Hope you all had a nice weekend.
I am currently learning how to make dynamic grouping via support table.
Customer Sales by Group =
CALCULATE( [Total Sales],
FILTER( VALUES( Customers[Customer Names] ),
COUNTROWS(
FILTER( 'Customer Groups',
RANKX( ALL( Customers[Customer Names] ), [Total Sales],,DESC ) > 'Customer Groups'[Min]
&& RANKX( ALL( Customers[Customer Names] ), [Total Sales],, DESC ) <= 'Customer Groups'[Max] ) )
> 0 ))
here is the fomula that i just learnt. So basically i created a new table that has 'Top 5', '5 to 20' and 'the rest' that evaulates the groups.
2 questions.
1. Why does there need be 'countrows >0' ? does the fomula not work if i dont have the countrows function there?
2. Why do i need all[customer names] in RANKX? if i remove all filters for Customers names by using 'ALL' fuction the total sales returns the same and i won't be able to rank customers by 'Sales Total'?
Thanks in advance for your help.
Cheers,
HI @Dankang,
#1. It is used to ignore result who not suitable for your conditions.(count row with blank table will blank result, power bi will recognize it as zero)
#2. All function is used to break filter effect to let formula calculated on whole table.
Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT
Regards,
Xiaoxin Sheng
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 44 | |
| 38 | |
| 34 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 66 | |
| 65 | |
| 30 | |
| 26 | |
| 25 |