Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ADSL
Post Prodigy
Post Prodigy

Find the Top 01 in Sales Group with Same Customer with last 03 month

Hi BI Community Team,

 

I have a sales order table for last 03 month that 01 customer service by multiple sales rep with different group.

 

Any suggestion/advise how to find which group are the Top 01 for last 03 month of these customer?

 

2023-06-26_16-43-14.png

 

Expect Result:

 

2023-06-26_17-56-32.png

 

Thanks and Regards,

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @ADSL 

 

You can try the following methods.

Measure = 
Var _MaxValue= CALCULATE( MAX(SalesOrder[Amount]), ALLEXCEPT(SalesOrder, SalesOrder[Customer Code]))
Var _Sum=SUM(SalesOrder[Amount])
Return
IF(_MaxValue=_Sum,1,0)

vzhangti_0-1688025724415.pngvzhangti_1-1688025748278.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @ADSL 

 

You can try the following methods.
Measure:

Sum = CALCULATE(SUM(SalesOrder[Amount]),ALLEXCEPT(SalesOrder,SalesOrder[Group Name]))

vzhangti_0-1687915834003.png

Measure = 
Var _table=SUMMARIZE(ALL(SalesOrder),SalesOrder[Group Name],"SUM",[Sum])
Var _MaxSum=MAXX(_table,[SUM])
Return
IF([Sum]=_MaxSum,1,0)

vzhangti_1-1687915875249.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-zhangti ,

 

After I have add a few more customers and apply these measure, the result is not correctly.

 

You can check the screenshot below. Group D is the top that sort by group, but when applied the measure that you feedback. Then group D is always the Top.

 

2023-06-29_13-51-01.png

As per expectation, we need to find the Top 01 of Sales Rep that assigne to which group.

 

If we look at the yellow highlight, it's correct one.

 

2023-06-29_14-06-04.png

 

Any suggestion?

 

Thanks and Regards,

 

 

 

 

v-zhangti
Community Support
Community Support

Hi, @ADSL 

 

You can try the following methods.

Measure = 
Var _MaxValue= CALCULATE( MAX(SalesOrder[Amount]), ALLEXCEPT(SalesOrder, SalesOrder[Customer Code]))
Var _Sum=SUM(SalesOrder[Amount])
Return
IF(_MaxValue=_Sum,1,0)

vzhangti_0-1688025724415.pngvzhangti_1-1688025748278.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.