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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.