Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

count with filter

Dear All,   I would like to count id if id date >= 01/07/2020 for both channel. The returned result will be 1 which is id 4. How can I write the measure column for this please help. Thanks 
  • MattAllington's avatar
    5 years ago

    it's quite tricky. You should write a measure, not a column. The principle in DAX is "filter first, evaluate second". So you could try this (I haven't tested it).

     

     

    =
    CALCULATE (
        SUMX ( values(tablename[id]), IF ( calculate(countrows ( tablename[id] )) > 1, 1 ) ),
        FILTER ( tablename, tablename[date] >= DATE ( 2020, 7, 1 ) )
    )