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
Anupal
Frequent Visitor

DAX to show 2 IF Statements in one field

Hello,

 

I have 2 Flag fields(working as slicers and Containing values as YES and NO). I need to write a DAX including both flag fields in a IF condition such as WHEN these slicers are selected as YES then my measure should show as BLANK.

 

Eg:--(Below DAX I created but its not working)

 

Forecast Revenue =
VAR SelectionP = SELECTEDVALUE(DT_Table1[Custom flag 1])
VAR SelectionT = SELECTEDVALUE(DT_Table2[Custom flag 1])
RETURN
IF (
SelectionP = "Yes",
BLANK(),
IF (
SelectionT = "Yes",
BLANK(),

CALCULATE(
[Forecast Revenue], FT_Forecast[Fiscal Calendar[Quarter Aging]]]=0
)
))

 

Any help will be appreciated.

 

Thanks 

AP

2 ACCEPTED SOLUTIONS
BeaBF
Super User
Super User

@Anupal Hi! Try with:

Forecast Revenue =
VAR SelectionP = SELECTEDVALUE(DT_Table1[Custom flag 1])
VAR SelectionT = SELECTEDVALUE(DT_Table2[Custom flag 1])
RETURN
IF (
SelectionP = "Yes" || SelectionT = "Yes", -- Check if either of the flags is "Yes"
BLANK(),
CALCULATE(
[Forecast Revenue],
FT_Forecast[Fiscal Calendar[Quarter Aging]] = 0 -- Corrected the filter condition
)
)

 

BBF

View solution in original post

ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Measure 31 = var _sel1 = SELECTEDVALUE('Table (45)'[Column1])
var _sel2 = SELECTEDVALUE('Table (44)'[Column1])
RETURN
SWITCH(TRUE(),_sel1 = "Yes" && _sel2 = "Yes",BLANK(),
10000)

ValtteriN_0-1731400791533.pngValtteriN_1-1731400805444.png

Now if both selections are yes the value is blank. You can add different cases like this:

Measure 31 = var _sel1 = SELECTEDVALUE('Table (45)'[Column1])
var _sel2 = SELECTEDVALUE('Table (44)'[Column1])
RETURN
SWITCH(TRUE(),_sel1 = "Yes" && _sel2 = "Yes",BLANK(),
_sel1 = "No" && _sel2 = "Yes",100,
10000)
ValtteriN_2-1731400884369.png

 

Place your measure where 10 000 value is.

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

3 REPLIES 3
Anupal
Frequent Visitor

Thanks @BeaBF : it worked perfectly! 🙂

ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Measure 31 = var _sel1 = SELECTEDVALUE('Table (45)'[Column1])
var _sel2 = SELECTEDVALUE('Table (44)'[Column1])
RETURN
SWITCH(TRUE(),_sel1 = "Yes" && _sel2 = "Yes",BLANK(),
10000)

ValtteriN_0-1731400791533.pngValtteriN_1-1731400805444.png

Now if both selections are yes the value is blank. You can add different cases like this:

Measure 31 = var _sel1 = SELECTEDVALUE('Table (45)'[Column1])
var _sel2 = SELECTEDVALUE('Table (44)'[Column1])
RETURN
SWITCH(TRUE(),_sel1 = "Yes" && _sel2 = "Yes",BLANK(),
_sel1 = "No" && _sel2 = "Yes",100,
10000)
ValtteriN_2-1731400884369.png

 

Place your measure where 10 000 value is.

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!




BeaBF
Super User
Super User

@Anupal Hi! Try with:

Forecast Revenue =
VAR SelectionP = SELECTEDVALUE(DT_Table1[Custom flag 1])
VAR SelectionT = SELECTEDVALUE(DT_Table2[Custom flag 1])
RETURN
IF (
SelectionP = "Yes" || SelectionT = "Yes", -- Check if either of the flags is "Yes"
BLANK(),
CALCULATE(
[Forecast Revenue],
FT_Forecast[Fiscal Calendar[Quarter Aging]] = 0 -- Corrected the filter condition
)
)

 

BBF

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.