Forum Discussion

Pklu's avatar
Pklu
Frequent Visitor
2 years ago
Solved

Count For Dropdown Items

I have a list table with the following intems:

 

Item 1        Color

Lolipop      Red

Cabbage   Green

Lettuce     Green

Beets        Red

Apple       Red

Peaches   Red

Olive        Black

Grapes     White

 

And I just wanted to display the sum or count for each color in the list. So my dashboard i would have something like:

# of Red = 4, # of White = 1, # of Green = 2.

 

How do I go about doing so? Any help is greatly appreciated. Is it possible?

 

Thanks,

 

PK

  • To make sure the result does not display "Blank" you can do the following: just add + 0 at the of your measures. So my finaly measure was:

     

    Red_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Red")) + 0
    Green_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Green")) + 0
    White_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="White")) + 0
    Black_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Black")) + 0

4 Replies

  • Pklu add a measure and then use color and the measure in the table visual:

     

    Count Measure = COUNTROWS ( YourTable )

     

     

    • Pklu's avatar
      Pklu
      Frequent Visitor

      Thanks for the reply. BUt how do I count the different colors - the function you sent was just to count the everything, I need to be able to count only the individual colors into a measure.

       

      So I tried -

       

      Count_Green = COUNTROWS ( Color = value, "Red") but it didn't work. So I am still stuck on this. But thanks for the help.

  • Pklu's avatar
    Pklu
    Frequent Visitor

    I think I found the solution. I used the following

     

    Red_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Red"))
    Green_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Green"))
    White_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="White"))
    Black_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Black"))
     
    And it worked perfectly. Thank you all for helping out.But now the question is, how do I make sure that each measure does not have blank and if they do, make it equal to 0.
     
    Thanks,
    • Pklu's avatar
      Pklu
      Frequent Visitor

      To make sure the result does not display "Blank" you can do the following: just add + 0 at the of your measures. So my finaly measure was:

       

      Red_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Red")) + 0
      Green_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Green")) + 0
      White_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="White")) + 0
      Black_Measure = COUNTROWS(FILTER(ALLSELECTED('TableName'),[Color]="Black")) + 0