cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
schoden
Post Partisan
Post Partisan

Products purchased by Same Customer

Hi Community, 

 

I tried to group customers based on purchasing same TYPE of product or Not.

If customer A buys fruit and machine , it is Mixed  otherwise Non- mixed.

 

Result.JPG

I tried to find previous row value, apply condition of mixed and non- mixed but couldnt achieve what I needed.

Any help will be appreciated.

 

For the test file: 

https://netlinkgroup-my.sharepoint.com/:u:/g/personal/schoden_netlinkgroup_com_au/EUA7Tf_fbXBNpx54Yx...

2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

Hi @schoden 

 

Download PBIX with solution

 

This measure does the trick

 

 

Measure = 

VAR _DistinctType = CALCULATE(DISTINCTCOUNT('Table'[Type]), FILTER(ALL('Table'), 'Table'[Customer ] = SELECTEDVALUE('Table'[Customer ])))

RETURN 

IF (_DistinctType > 1, "Mixed", "Not Mixed")

 

 

mixed.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

VahidDM
Super User
Super User

Hi @schoden 

 

Use this code to add a new table:

New Table = SUMMARIZE('Table','Table'[Customer ],"Check",if(CALCULATE(DISTINCTCOUNT('Table'[Type]),ALLEXCEPT('Table','Table'[Customer ]))>1,"Mixed","Not Mixed"))
                  

 

Output:

 

VahidDM_0-1636698086311.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

Hi @schoden 

 

Use this code to add a new table:

New Table = SUMMARIZE('Table','Table'[Customer ],"Check",if(CALCULATE(DISTINCTCOUNT('Table'[Type]),ALLEXCEPT('Table','Table'[Customer ]))>1,"Mixed","Not Mixed"))
                  

 

Output:

 

VahidDM_0-1636698086311.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Thanks for saving my day 😄

PhilipTreacy
Super User
Super User

Hi @schoden 

 

Download PBIX with solution

 

This measure does the trick

 

 

Measure = 

VAR _DistinctType = CALCULATE(DISTINCTCOUNT('Table'[Type]), FILTER(ALL('Table'), 'Table'[Customer ] = SELECTEDVALUE('Table'[Customer ])))

RETURN 

IF (_DistinctType > 1, "Mixed", "Not Mixed")

 

 

mixed.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thanks for sharing the knowledge 😄 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors