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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JarekkWr
Helper I
Helper I

Show orders with multiple product categories

Hello!

 

I have dataset with orders. Some orders have products from only one category, other orders have products from multiple categories. I'd like to show how many orders have products from multiple categories and how many orders have products from only one category. Additionaly I'd like to have possibility to see orders that contains selected category.

 

I tried with DISTINCTCOUNT and it showed orders with multiple categories but I couldn't filter by selected category. Is there any solution?

 

Example data table is below:

 

orderproductdivision
b112a
b121b
b122b
b212a
b221b
b222b
b232c
b332c
b332c
b412a
b432c
b532c
b621b
b622b

Thanks for any hints!

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @JarekkWr ,

Try the following measure:

Measure = CALCULATE(DISTINCTCOUNT('Table'[order]),FILTER(ALLSELECTED('Table'),'Table'[product]=MAX('Table'[product])))

It will return what you want!

vluwangmsft_0-1626937079229.png

vluwangmsft_1-1626937090087.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi @JarekkWr ,

Try the following measure:

Measure = CALCULATE(DISTINCTCOUNT('Table'[order]),FILTER(ALLSELECTED('Table'),'Table'[product]=MAX('Table'[product])))

It will return what you want!

vluwangmsft_0-1626937079229.png

vluwangmsft_1-1626937090087.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

amitchandak
Super User
Super User

@JarekkWr , Plot this measure with product

countx(filter(summarize(Table, Table[product], "_1", distinctCOUNT(Table[division])), [_1]>1), [product])

 

Change the column in measure as per need

 

Thanks @amitchandak , unfortunately this measure gives no result, even on my sample data 😞

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.