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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Distinct/ Distinct count by key category

Hi everyone,

I need your help😥

 

I would like to add red column to my table.

Key of the group for distinction would be "show" and "FY".

 

 

shop

item

FY

item count

itme name

AAA

Paper Goods

2020

4

Paper Goods,Bread/Bakery ,Frozen Foods,Other

AAA

Bread/Bakery 

2020

4

Paper Goods,Bread/Bakery ,Frozen Foods,Other

AAA

Frozen Foods

2020

4

Paper Goods,Bread/Bakery ,Frozen Foods,Other

B

Paper Goods

2020

3

Paper Goods,Bread/Bakery,Personal Care 

B

Bread/Bakery 

2020

3

Paper Goods,Bread/Bakery,Personal Care 

B

Personal Care 

2020

3

Paper Goods,Bread/Bakery,Personal Care 

AAA

Bread/Bakery 

2020

4

Paper Goods,Bread/Bakery ,Frozen Foods,Paper Goods

AAA

Other

2020

4

Paper Goods,Bread/Bakery ,Frozen Foods,Other

1 ACCEPTED SOLUTION

@Anonymous , try like

Measure = CALCULATE(COUNTX(VALUES('Item'[Item]),('Item'[Item])),ALLEXCEPT('Item','Item'[shop] , Item'[FY] ))

Measure = CALCULATE(CONCATENATEX(VALUES('Table'[Item]),('Table'[Item])),ALLEXCEPT('Table','Item'[shop] , 'Item'[FY] ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous , try new measures like

calculate(concatenatex(Table,distinct(Table[item])), allexcept(Table[shop]))

or

calculate(concatenatex(Table,values(Table[item])), allexcept(Table[shop]))

https://docs.microsoft.com/en-us/dax/concatenatex-function-dax


calculate(distinctCOUNT(distinct(Table[item]), allexcept(Table[shop]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak 

thank you for your help.😀

 

I've trid but Ive got an error on following 😅

calculate(concatenatex(Table,distinct(Table[item])), allexcept(Table[shop]))

 

so i change to following.

calculate(concatenatex(Table,distinct(Table[item])), allexcept(Table,Table[shop]))

but when i add to the vidual it shows another error.

"can't display the vidual."

 

 

@Anonymous , Try like this tested on my table

Measure = CALCULATE(CONCATENATEX(VALUES('Item'[Category]),('Item'[Category])),ALLEXCEPT('Item','Item'[Brand]))

Measure = CALCULATE(CONCATENATEX(VALUES('Table'[Item]),('Table'[Item])),ALLEXCEPT('Table','Item'[shop]))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak 

 

Thank you for your help😀

 

I would like to add a condition shop and FY in one measure.

I've triedlike this but did not work...

Measure = CALCULATE(COUNTX(VALUES('Item'[Item]),('Item'[Item])),ALLEXCEPT('Item','Item'[shop] &&'Item'[FY] ))

Measure = CALCULATE(CONCATENATEX(VALUES('Table'[Item]),('Table'[Item])),ALLEXCEPT('Table','Item'[shop] && 'Item'[FY] ))

@Anonymous , try like

Measure = CALCULATE(COUNTX(VALUES('Item'[Item]),('Item'[Item])),ALLEXCEPT('Item','Item'[shop] , Item'[FY] ))

Measure = CALCULATE(CONCATENATEX(VALUES('Table'[Item]),('Table'[Item])),ALLEXCEPT('Table','Item'[shop] , 'Item'[FY] ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak 

that was perfect😂

Thank you so much😌

Anonymous
Not applicable

@amitchandak 

 

Thank you !😆

 

Would you please advice me how to add a key to distinct?

I would like to distinct shop and FY.

 

 

@Anonymous , Try like

Measure = CALCULATE(COUNTX(VALUES('Item'[Category]),('Item'[Category])),ALLEXCEPT('Item','Item'[Brand]))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.