cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dankang Frequent Visitor
Frequent Visitor

Dynamic Grouping via Support table

 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,

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Dynamic Grouping via Support table

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

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
2 REPLIES 2
Dankang Frequent Visitor
Frequent Visitor

Dynamic Group via support table

 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,

Community Support Team
Community Support Team

Re: Dynamic Grouping via Support table

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

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 133 members 1,683 guests
Please welcome our newest community members: