Forum Discussion

pbi_girl_21's avatar
pbi_girl_21
New Member
2 years ago
Solved

Counting Products based on Indicator

Hi Everyone,   I have a complex calcuation I can't seem to figure out!   I have a table of data with grocery store names and products. The products are fruits, veggies, meat etc... but I only car...
  • talespin's avatar
    2 years ago

    hi pbi_girl_21 

     

    You can use these Measures.

     

    Fruit Count =
    VAR _FruitCount = CALCULATE(DISTINCTCOUNT(Fruits[Product]), Fruits[Fruit Indicator] = 1)

    RETURN IF( ISBLANK(_FruitCount), 0 , _FruitCount)
     
     
    Fruits =
    VAR _FruitCount = [Fruit Count]
    RETURN IF(_FruitCount = 1, CALCULATE( VALUES(Fruits[Product]), Fruits[Fruit Indicator] = 1) , BLANK())
     
     
    You can also show all the fruits in a Store if that is the requirement.