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
T_EA
New Member

Help with Conditional formatting DAX

Hi All, 

I hope I have the correct section of the forum, I have a DAX formula see below:

 

CF = VAR _today = TODAY() RETURN SWITCH( TRUE(), SELECTEDVALUE(Data[Expiry_Date]) <_today, "#FEB99C", SELECTEDVALUE(Data[Expiry_Date]) < _today + 30, "#FFED93", "#CDFA93")
 
essentially colours data in matrix based on expiry date, the issue I have is the <_today is colouring the boxes where there is a null value. I would rather these boxes be left blank, any help / pointers greatly appreciated
1 ACCEPTED SOLUTION
sanalytics
Super User
Super User

@T_EA 
Can you ISBLANK function for identifying the blank.. Your modifed DAX code should be below

CF =
VAR _today = TODAY()
VAR _expiryDate = SELECTEDVALUE(Data[Expiry_Date])
RETURN
    SWITCH(
        TRUE(),
        ISBLANK(_expiryDate), BLANK(),
        _expiryDate < _today, "#FEB99C",
        _expiryDate < _today + 30, "#FFED93",
        "#CDFA93"
    )

check if it is working or not.. If it is not working.. then suggesting to provide some dummy data and desired result to try from out end..

 

Hope it will help.

 

Regards,

sanalytics

View solution in original post

2 REPLIES 2
T_EA
New Member

Thanks ever so much 🙂

worked like a charm and is exactly what I was looking for.

 

Thank you again

sanalytics
Super User
Super User

@T_EA 
Can you ISBLANK function for identifying the blank.. Your modifed DAX code should be below

CF =
VAR _today = TODAY()
VAR _expiryDate = SELECTEDVALUE(Data[Expiry_Date])
RETURN
    SWITCH(
        TRUE(),
        ISBLANK(_expiryDate), BLANK(),
        _expiryDate < _today, "#FEB99C",
        _expiryDate < _today + 30, "#FFED93",
        "#CDFA93"
    )

check if it is working or not.. If it is not working.. then suggesting to provide some dummy data and desired result to try from out end..

 

Hope it will help.

 

Regards,

sanalytics

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.