Forum Discussion

prpaz's avatar
prpaz
Regular Visitor
2 years ago
Solved

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...
  • Anonymous's avatar
    Anonymous
    2 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.