Forum Discussion

simlee's avatar
simlee
Frequent Visitor
6 years ago
Solved

Measure count rows based on two column comparison and a filter

Hello guys, 

I'm looking for a measure of row count bases on column "C" = No Match and column "B value is bigger than A" = yes

As you can see in the below example, the count based on the two filters = 3

I try this formula but no success


Measure 1 =
CALCULATE (
COUNTROWS ('table'),
FILTER (
'table',
AND ( 'table'[c] = "Match", 'table'[D] = "yes" )
)
)

 

 I would be greatful if someone can help me figure out how this can be done.

  • Hi,

    Try this measure

    =COUNTROWS(FILTER(Table,Table[C]="No match"&&Table[B]>Table[A]))

    Hope this helps.

7 Replies

  • Hi,

    Try this measure

    =COUNTROWS(FILTER(Table,Table[C]="No match"&&Table[B]>Table[A]))

    Hope this helps.

    • simlee's avatar
      simlee
      Frequent Visitor

      Thank you Ashish. It's working perferctly 

    • kschaefer's avatar
      kschaefer
      New Member

      Hey Ashish,

       

      I am still pretty new to Power BI so I am trying to take all of this in stride.

       

      If you had the same situation, but had to compare columns from two separate tables instead of one table, what would you do? Would you have to use something like SUMMARIZE() to get something to like this to work?

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

        Please share some data, describe your question and show the expected result.

  • In column D, there is no value for Match True

    Measure 1 =
    CALCULATE (
    COUNTROWS ('table'),
    FILTER (
    'table',
    AND ( 'table'[c] = "No Match", 'table'[D] = "yes" )
    )
    )

    • simlee's avatar
      simlee
      Frequent Visitor

      basically it's a measure based on two filters in 2 different columns; the "No match" in column B and "yes" on column D