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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Newbie Alert: Need for an ISBLANK Wrapper on a multiple If Statement

Morning All

 

Im looking for some handholding and this says more about my DAX skils than anythoing. But if you dont know; you dont know.

 

Context:   This table  tbl_POAP_master[Days Till Due Date is a number coumn which is essentially a countdown to the due date. So every day this will shift left by 1.   Something like Days Till Due Date = DATEDIFF(today(), tbl_POAP_master[Due Date],DAY)

.All is good with this and thats not my main problem.

 

My  challenge is I want a calculated column based on these numbers so I wrote this:

 

DUE RED AMBER GREEN = if (tbl_POAP_master[Days Till Due Date]<0,"RED",
if (tbl_POAP_master[Days Till Due Date]<=10,"AMBER",
if (tbl_POAP_master[Days Till Due Date]<=30,"BLUE",
"Future Due Date")))
 
The output of above is as follows and note I have filtered out blanks:
 
jimmyg706_0-1694671292107.png

 

Now if I unfilter blanks  in above you will see Blanks are showing as Amber.   But Amber is my "due in less than 10x days" and I dont want that.

 

jimmyg706_1-1694671477852.png

 

I dont know why its doing this but Im sure somehow I can wrap this with some statement for blanks or have a if treatment for blanks.

 

Just to say they really are blank columns and not just empty

 

Thanks for all the support Ive been getting with some lame queestions. Im not a PBI UI SME  or develoepr but Ive gained enough insight to transform reporting within a 20+  person team.


Comments welcome.

 

Jimmy

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , First handle is blank and give a value

example 

 

DUE RED AMBER GREEN =Switch(true() ,
isblank(tbl_POAP_master[Days Till Due Date]) , "Yellow"
tbl_POAP_master[Days Till Due Date] < 0, "RED",
tbl_POAP_master[Days Till Due Date] <= 10, "AMBER",
tbl_POAP_master[Days Till Due Date] <= 30, "BLUE",
"Future Due Date"
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

thanks @amitchandak   It worked a treat. I even spotted a missing comma on the code you supplied. 🙂

 

Much better than a multiple if which I would imagine would also affect performance.

 

Question:  The Slicer I have displays options in a drop down as per Figure 1.

 

  1. Is it possible for you to have these in a specifc order?  e.g Task is Late appears first
  2. Is it possible for you to make one of the drop down selections a different colour e.g Task Is Late - I would like to see it as RED?

 

 

Fig 1 

jimmyg706_0-1694684413434.png

 

The DAX is as follows:

 

GROUP_DUE_DATES = Switch(true() ,
isblank(tbl_POAP_master[Days Till Due Date]) , "No Due Date",
tbl_POAP_master[Days Till Due Date] < 0, "Task is Late",
tbl_POAP_master[Days Till Due Date] <= 10, "Due <10x Days",
tbl_POAP_master[Days Till Due Date] <= 30, "Due <30x Days",
"Due >30x Days")
 
 
Thanks
 
James
 
 

 

amitchandak
Super User
Super User

@Anonymous , First handle is blank and give a value

example 

 

DUE RED AMBER GREEN =Switch(true() ,
isblank(tbl_POAP_master[Days Till Due Date]) , "Yellow"
tbl_POAP_master[Days Till Due Date] < 0, "RED",
tbl_POAP_master[Days Till Due Date] <= 10, "AMBER",
tbl_POAP_master[Days Till Due Date] <= 30, "BLUE",
"Future Due Date"
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (4,368)