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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Avivek
Post Partisan
Post Partisan

Need help with IF Dax

I need to create a dax with 2 conditions, I am able to add one condition but not both.

I need the dax to be something like this-

Measure 2 = SWITCH((SELECTEDVALUE(Sales[System Id]),"TX-300.301") || SELECTEDVALUE(Division[Division Id]= "100800",  1,0))
Avivek_0-1685632020487.png

 

But I am able to add only one condition at a time.I also tried 
Measure 2 = IF(SELECTEDVALUE(Sales[System Id]),"TX-300.301" && SELECTEDVALUE(Sales[Division Id],"1008800.00"),1)
But this doesn't work.
Can someone please let me know where I am making the mistake and what would be the right DAX?
1 ACCEPTED SOLUTION
rsbin
Super User
Super User

@Avivek ,

I think the issue is the syntax.  Please try this:

Measure 2 = SWITCH(
                TRUE(),
           AND(SELECTEDVALUE(Sales[System Id])="TX-300.301",
               SELECTEDVALUE(Division[Division Id])= "100800"), 1,
               0)

 Is your Division ID a text value or numeric?  In your Measure, the fact that you put in "", I am assuming this field is text.  If not, then remove the quotation marks.

Hope this gets you sorted out.

Regards,

View solution in original post

1 REPLY 1
rsbin
Super User
Super User

@Avivek ,

I think the issue is the syntax.  Please try this:

Measure 2 = SWITCH(
                TRUE(),
           AND(SELECTEDVALUE(Sales[System Id])="TX-300.301",
               SELECTEDVALUE(Division[Division Id])= "100800"), 1,
               0)

 Is your Division ID a text value or numeric?  In your Measure, the fact that you put in "", I am assuming this field is text.  If not, then remove the quotation marks.

Hope this gets you sorted out.

Regards,

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.