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
unclejemima
Post Patron
Post Patron

Another IF AND statement question with more than 2 variables :-)

I've got this exact senario what I would typicall use a "If(OR..." statement, but I can't because I can only do 2 arguments...I think I need to use SWITCH but I'm not sure.  Can someone give me the DAX formula for the following...

 

If trandata[account] number is between 6001-6098, or 7030, 7926 or 9071 then retreive the values from trandata[amount]

 

Please and thank you!!!

 

 

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@unclejemima

 

Hi, lets try with this calculated column:

 

M =
IF (
Trandata[Account] >= 6001
&& Trandata[Account] <= 6098
|| Trandata[Account] = 7030
|| Trandata[Account] = 7926
|| Trandata[Account] = 9071;
Trandata[Amount]
)

 

 

Regards

 

Victor




Lima - Peru

View solution in original post

7 REPLIES 7
Vvelarde
Community Champion
Community Champion

@unclejemima

 

Hi, lets try with this calculated column:

 

M =
IF (
Trandata[Account] >= 6001
&& Trandata[Account] <= 6098
|| Trandata[Account] = 7030
|| Trandata[Account] = 7926
|| Trandata[Account] = 9071;
Trandata[Amount]
)

 

 

Regards

 

Victor




Lima - Peru

@unclejemima

 

A shorter version will be:

 

M =
IF (
    Trandata[Account] >= 6001
        && Trandata[Account] <= 6098
        || Trandata[Account] IN { 7030; 7926; 9071 };
    Trandata[Amount]
)

Regards

 

Victor




Lima - Peru

Thanks Vvelarde for the super quick reply!!

 

I tried the both options...but getting an error

 

The syntax for ';' is incorrect. (DAX(IF ( Trandata[Account] >= 6001 && Trandata[Account] <= 6098 || Trandata[Account] IN { 7030; 7926; 9071 }; Trandata[amount]))).

 

Do I have something wrong?

 

I pasted your exact DAX in.

I  changed the 

;

 to a 

,

and I think that might do it...trying now...

I was able to get this to work...

 

M = 
IF (
 Trandata[account] >= 6001
 && Trandata[Account] <= 6098
 || Trandata[Account] = 7030
 || Trandata[Account] = 7926
 || Trandata[Account] = 9071,
 Trandata[Amount],blank()
)

I like the shorter option you proposed, but could not get it to work.

@unclejemima

 

Yeah is Regional Settings. My settings is with ; 

 

Regards

 

Victor




Lima - Peru

lol.  Darn regional settings lol.

 

Thank you though. Formula is working awesome :-)!!!!!

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.