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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bchager6
Super User
Super User

Nested IF, AND, OR statement

Hi All,

I need to create a calculated colum that will populate rows with "True" if the following conditions are met. Else, "False."

If ActualProgress% = 100% AND the "In Budgted Year" is the current year, or if ActualProgress% <>100% and is in any "In Budgeted Year", then "True," else "False."

 

I believe it could be said another way as, if ActualProgress% is 100% but not In Budgeted Year for the current year, "False," else "True."

 

Here's what I wrote: 
% complete calc. = IF('Table'[ActualProgress%]=1,IF('Table'[In Budgeted Year]<>YEAR(TODAY()),"False","True"))

 

It's returning "False" where the "ActualProgress%" is 100% and the "In Budgeted Year" <> 2019 (as it should). It's returning "True" if "ActualProgress%" is 100% and the "In Budgeted Year" is 2019 (as it should), but it's returning blanks where "ActualProgress%" is not 100%, regardless of what the "In Budgeted Year" value is. 

 

Any thoughts? I'm thinking that I need to stick an "OR" or an "AND" in there somewhere.

 

Capture.JPG

 

1 ACCEPTED SOLUTION
JarroVGIT
Resident Rockstar
Resident Rockstar

Hi, you can use parentesis in combination with && (and) and || (or) for complex IF statements without those nasty nesting IF statements 🙂 . You dax would be like this in this case. 

% complete calc. = IF('Table'[ActualProgress%]=1 && 'Table'[In Budgeted Year] <> YEAR(TODAY()), FALSE, TRUE)

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
JarroVGIT
Resident Rockstar
Resident Rockstar

Hi, you can use parentesis in combination with && (and) and || (or) for complex IF statements without those nasty nesting IF statements 🙂 . You dax would be like this in this case. 

% complete calc. = IF('Table'[ActualProgress%]=1 && 'Table'[In Budgeted Year] <> YEAR(TODAY()), FALSE, TRUE)

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂





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

Proud to be a Super User!




Ah! Forgot about using the double ampersand! Thank you so much!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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