Forum Discussion
prpaz
2 years agoRegular Visitor
Calculate distinct items by classification
Hello friends, I have the following question about creating a measure. I have two related tables, items and classification. I need a measure that calculates the number of distinct items that have...
- Anonymous2 years ago
Hi prpaz ,
We can create measures.
Flag = var _table=SUMMARIZE('classification','classification'[item],'classification'[classification]) var _count=COUNTROWS(FILTER(_table,[item] in VALUES('classification'[item]))) RETURN IF(_count=1,1,0)count = SUMX(VALUES('classification'[item]),[Flag])Then the result is as follows, the number of items that have only one type of classification is 7.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PijushRoy
2 years agoCommunity Champion
HI prpaz
Can you please try the below code in Measure
Measure =
CALCULATE(DISTINCTCOUNT('table Classification'[classification]),'table Classification'[classification]="orange")
Please change the DISTINCTCOUNT column name which you want to count
If solve your requirement, please mark as SOLUTION
Thanks
Pijush
prpaz
2 years agoRegular Visitor
Hello, an item can have several classifications, but I only need the distinct count of the items in each classification for comparison in the graph, see example:
Orange.... 4
Red................5
Blue.....1