Forum Discussion
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 |
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] ))
8 Replies
- amitchandakSuper 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]))- AnonymousNot applicable
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."
- amitchandakSuper User
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]))