Forum Discussion

SimDam's avatar
SimDam
Icon for Helper I rankHelper I
3 years ago
Solved

Count group by with condition

Hi, Considering the below table   Order Period   Item Test 100 7/1/2022   1 0 100 7/1/2022   2 0 100 7/1/2022   3 1 100 8/1/2022   1 0 100 8/1/2022   2 0 ...
  • FreemanZ's avatar
    3 years ago

    hi SimDam 

    try to write the measure like this:

    TestCount = 
    VAR _table = 
    ADDCOLUMNS(
        VALUES(TableName[Period]),
        "Test",    
        CALCULATE(MAX(TableName[Test]))
    )
    RETURN
    COUNTROWS(FILTER(_table, [Test]=1))

     

    it worked like this: