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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Stuznet
Helper V
Helper V

Switch Function Replaced Nested IF

 

Hi guys,

I need help writing nested IF isblank statement. 

Here is my currently working dax function but I have another condition that I need to include in this statement. 

 

 

AgeBracket = IF('Data'[Date1]<31,"0-30 Days", IF('Data'[Date1]'<46, "31-45 Days","45+Days"))

 

So basically, Current Date minus Date1 if is blank then use Date2. If you look at the last row as an example. 

How do I write a proper statement for this logic?

 

Thank you 

 

Date1Date2Age Bracket
6/1/20188/4/201845+Days
6/14/20188/4/201845+Days
5/13/20188/8/201831-45 Days
10/1/20178/9/201831-45 Days
 8/8/2018??
1 ACCEPTED SOLUTION

Hi @Stuznet,

 

Try this one, please.

Column =
VAR date1 =
    IF ( ISBLANK ( [Date1] ), [Date2], [Date1] )
VAR days =
    TODAY () - date1
RETURN
    IF ( days < 31, "0-30 days", IF ( days < 46, "31-45 days", "45 + days" ) )

Nested_IFs_ISBLANK_Then_Use_Other_Value

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
balaganeshv2201
Frequent Visitor

create on e calculated column 

Date = IF('Data'[Date1] = BLANK(),TODAY())

after that apply your function

@balaganeshv2201I tried incorporate the formula you provided but I'm getting incorrect syntax highlighted in red.

 

AgeBracket = IF('Data'[Date1]=BLANK(),TODAY())"0-30 Days", IF('Data'[Date1]<46, "31-45 Days","45+Days"))

How do I tell DAX if Date 1 is blank then look for Date2 then give me 0-30 Days, 31-45 Days or 45+Days result? Could you please elaborate or educate me the proper function? 

 

 

 

Hi @Stuznet,

 

Try this one, please.

Column =
VAR date1 =
    IF ( ISBLANK ( [Date1] ), [Date2], [Date1] )
VAR days =
    TODAY () - date1
RETURN
    IF ( days < 31, "0-30 days", IF ( days < 46, "31-45 days", "45 + days" ) )

Nested_IFs_ISBLANK_Then_Use_Other_Value

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much for youe work 🙂 

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.

Top Solution Authors