Forum Discussion

jabrillo's avatar
jabrillo
Helper I
2 years ago
Solved

Measure as Condition Not Working

I have a table of employees - Emp ID, Emp Name, Dept ID. I created two measures:

- Emp Count = count(Emp ID)

- Count Group = if(Emp Count < 10, "10 and below", "Over 10")

 

Can I create the table visual below without creating a table:

Count Group# of Depts
10 and below7
Over 101

 

  • Hi,

    Here is one way to this:

    data:

     




    Dax:

    Measure 15 = var _vtable =
    SUMMARIZE('Table (26)','Table (26)'[Department],"ids",COUNT('Table (26)'[ID]))
    var _over2 = COUNTROWS(FILTER(_vtable,[ids]>=2))
    var _under2 = COUNTROWS(FILTER(_vtable,[ids]<2))
    RETURN
    "2 and over dep: " & _over2 & " under 2 dep: "  & _under2


    End result: 

    You can add unichar 10 for linebreak:

    Measure 15 = var _vtable =
    SUMMARIZE('Table (26)','Table (26)'[Department],"ids",COUNT('Table (26)'[ID]))
    var _over2 = COUNTROWS(FILTER(_vtable,[ids]>=2))
    var _under2 = COUNTROWS(FILTER(_vtable,[ids]<2))
    RETURN
    "2 and over dep: " & _over2 &UNICHAR(10)& " under 2 dep: "  & _under2


     




    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

4 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    Here is one way to this:

    data:

     




    Dax:

    Measure 15 = var _vtable =
    SUMMARIZE('Table (26)','Table (26)'[Department],"ids",COUNT('Table (26)'[ID]))
    var _over2 = COUNTROWS(FILTER(_vtable,[ids]>=2))
    var _under2 = COUNTROWS(FILTER(_vtable,[ids]<2))
    RETURN
    "2 and over dep: " & _over2 & " under 2 dep: "  & _under2


    End result: 

    You can add unichar 10 for linebreak:

    Measure 15 = var _vtable =
    SUMMARIZE('Table (26)','Table (26)'[Department],"ids",COUNT('Table (26)'[ID]))
    var _over2 = COUNTROWS(FILTER(_vtable,[ids]>=2))
    var _under2 = COUNTROWS(FILTER(_vtable,[ids]<2))
    RETURN
    "2 and over dep: " & _over2 &UNICHAR(10)& " under 2 dep: "  & _under2


     




    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
  • Hope it helps

    GROUP BY Count Group = SWITCH(TRUE(),

        [# of Depts] <= 10, "10 and below",

        [# of Depts] > 10, "Over 10"

    )

    If i understand  your requiement correctly