Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Converting Excel Countif

Hello Team, I am new to Power BI. I trying to convert the excel formula to DAX. Count Cases Last 31 =COUNTIFS(A:A,$A2,C:C,$C2,B:B,">="&$B2-30) Sample data is below:   Cust Site ID Case Crea...
  • AlexisOlson's avatar
    4 years ago

    There are lots of ways to do this. I'd suggest something like this as a calculated column:

    CountIf =
    VAR CurrRowDate = Table1[Case Create Date Time]
    RETURN
        CALCULATE (
            COUNTROWS ( Table1 ),
            ALLEXCEPT ( Table1, Table1[Cust Site ID], Table1[Case Type] ),
            Table1[Case Create Date Time] >= CurrRowDate - 30
        )