Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jabrillo
Helper I
Helper I

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

 

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

Here is one way to this:

data:

ValtteriN_0-1707490114850.png

 




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: 
ValtteriN_1-1707490135628.png

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


ValtteriN_2-1707490262511.png

 




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/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Learner27
Helper III
Helper III

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

Thank you

ValtteriN
Super User
Super User

Hi,

Here is one way to this:

data:

ValtteriN_0-1707490114850.png

 




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: 
ValtteriN_1-1707490135628.png

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


ValtteriN_2-1707490262511.png

 




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/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.