Forum Discussion

johnmelbourne's avatar
7 years ago
Solved

COUNTIF in DAX with multiple expressions

  Hi,   So I want to count the number of rows in a table where the column value in the table is between two ranges. In Excel it is like =COUNTIFS(A1:A50,">=1", A1:A50,"<=10")   how do I d...
  • Mariusz's avatar
    Mariusz
    7 years ago

    Hi johnmelbourne 

     

    You can add a column and use the expresion below.

    Column = 
    SWITCH(
        TRUE,
        Table1[pct] >= 0 && Table1[pct] <= 0.05, "0-5%",
        Table1[pct] >= 0.06 && Table1[pct] <= 0.1, "6-10%",
        Table1[pct] >= 0.11 && Table1[pct] <= 0.15, "11-15%",
        Table1[pct] >= 0.16 && Table1[pct] <= 0.2, "16-20%",
        Table1[pct] >= 0.2 && Table1[pct] <= 0.25, "20-25%",
        ">25%"
    )



    Hope this helps
    Mariusz