Forum Discussion

mellas_k's avatar
mellas_k
Helper I
9 years ago
Solved

How to use a multiple filter on the same column

hello ,

I need your help to optimize my work …

I will give you the below table to explain my problem  

Table :

columnA   columnB  column

A               A                    A

A               B                    B

B               B                    C

C               C                    D

 

From this table I need to calculate for each column the count of A , B and C

So I use this measure to calculate the number of “A” on columnA

   measure= (CALCULATE(COUNT(Table [columnA   ]);FILTER(Table; Table[columnA   ]="A")))

Can you please help me if there is any other possibility to regroup filter on the same measure …

 

Best Regards 

  • hi cs_skit

    Maybe you don’t understand me but with your example you give me what I need ..

    Just I need to add {in}

    measure= (CALCULATE(COUNT(Table [columnA   ]);FILTER(Table; Table[columnA ] IN{"A";"B")))

    And now I can do many filter on the same column

    thanks :)

8 Replies

  • does this work:

     

    CountAinAllCols =
    CALCULATE(COUNTROWS(ABCtable);ABCtable[ColumnA]="A") +
    CALCULATE(COUNTROWS(ABCtable);ABCtable[ColumnB]="A") +
    CALCULATE(COUNTROWS(ABCtable);ABCtable[ColumnC]="A")

    • mellas_k's avatar
      mellas_k
      Helper I

      hi cs_skit

      Thanks for your answer but I need to calculate each column separately by regrouping the filter

      Like this for example  :

      measure= (CALCULATE(COUNT(Table [columnA   ]);FILTER(Table; Table[columnA   ]="A"& “B” )))

      but it don't work ..

       

      thanks

      • cs_skit's avatar
        cs_skit
        Resolver IV

        Yeah sorry you need independent of current filter context

         

        CountAinAllCols =
        COUNTROWS(FILTER(ALL(ABCtable);[ColumnA]="A")) +
        COUNTROWS(FILTER(ALL(ABCtable);[ColumnB]="A")) +
        COUNTROWS(FILTER(ALL(ABCtable);[ColumnC]="A"))