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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Black3y
Microsoft Employee
Microsoft Employee

DAX IF/THEN Statement

Hi all,

 

I am trying to do a very simple measure to look at a field and simply create an IF "this" then "This" to basically relate what it currently a number to a Customer Name.  The field I am trying to use has the following symbol next to it, which seems to be stopping me using the the example formula below... I cannot find my fields this way.

 

Untitled.png

 

Measure = SWITCH(TRUE();
[NumberOfUsers] < 250; "SME";
[NumberOfUsers] < 1000 ; "Corporate";
[NumberOfUsers] < 5000 ; "Enterprise";
[NumberOfUsers] >= 5000 ; "Global";
BLANK())

 

Am I missing the point? 

 

Thanks for your help!

 

Mark

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

First, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Second, that is the symbol for a measure.

 

Third, guessing that [NumberOfUsers] is a column, you will need to use aggregation like so:

 

Measure = SWITCH(TRUE();
SUM([NumberOfUsers]) < 250; "SME";
SUM([NumberOfUsers]) < 1000 ; "Corporate";
SUM([NumberOfUsers]) < 5000 ; "Enterprise";
SUM([NumberOfUsers]) >= 5000 ; "Global";
BLANK())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

First, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Second, that is the symbol for a measure.

 

Third, guessing that [NumberOfUsers] is a column, you will need to use aggregation like so:

 

Measure = SWITCH(TRUE();
SUM([NumberOfUsers]) < 250; "SME";
SUM([NumberOfUsers]) < 1000 ; "Corporate";
SUM([NumberOfUsers]) < 5000 ; "Enterprise";
SUM([NumberOfUsers]) >= 5000 ; "Global";
BLANK())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I also appear to have copied the wrong symbol, which seems to be the reason i can't do a simple "IF" command on that field... See below what I meant to show you.

 

Untitled7.png

 

I am simply trying to create a measure that will look at the field "Enrollment Number" and search for certian strings, when it finds one then return a new Value. So for example if it finds "1098333" I want to return "BOB" into the new measure.

 

Mamy thanks for your support.

 

 

Apologies - I should have read that post first. I will have a read shortly.

 

I get the attached error below when trying to use your formula, which I know is becuase I didn't explain myself properly but I am unable to share the actual data and so used another example, but forgot to clarify the data type...

 

Untitled.png

 

This is the sort of thing I am trying to do, with the correct table name etc

 
Enrollment = SWITCH(TRUE(),SUM([Enrollment Number]) = "60077216","TEXT","87809449","TEXT2",BLANK())

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.