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

Detecting a Blank in a field

Hi All,

 

I created a column called Days Early or Late. It provides the difference in days between a Received Date column and Scheduled Due Date column. I created a second column that looks at the value in Days Early or Late and returns a value of Early, Late or On Time. Anything two days or more early is Early, two days or more late is Late and anything between 1 day early or late is On Time.

 

I am hoping to be able to add an additional value of On Order for any entries in Days Early or Late that are blank.

 

Here's the DAX:

 

 

Late or Early = switch ( 
    TRUE(), 
[Days Early or Late] <=-2, "Late",
[Days Early or Late] >=2, "Early",
[Days Early or Late] =1, "On Time",
[Days Early or Late] =-1, "On Time",
[Days Early or Late] =0, "On Time",
[Days Early or Late] =Blank(), "On Order",
"Other")

 

 

I've tried specifically to single out the On Time values, but Power BI seems to interpret 0 and Blank as the same. In the Days Early or Late, and future shipments without receipt to stock show a blank value, not a 0.

 

Sample Data:

Canknucklehead_1-1614191619055.png

 

Is there a way to have Power BI differentiate between a Blank and a 0 so that I can input the On Order value?

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Try this instead:

Late or Early =
SWITCH (
    TRUE (),
    [Days Early or Late] <= -2, "Late",
    [Days Early or Late] >= 2, "Early",
    [Days Early or Late] = 1, "On Time",
    [Days Early or Late] = -1, "On Time",
    ISBLANK ( [Days Early or Late] ), "On Order",
    [Days Early or Late] = 0, "On Time",
    "Other"
)

 

If that doesn't work, there may be a deeper issue going on with auto-exists.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Worked like a charm! Thanks!

AlexisOlson
Super User
Super User

Try this instead:

Late or Early =
SWITCH (
    TRUE (),
    [Days Early or Late] <= -2, "Late",
    [Days Early or Late] >= 2, "Early",
    [Days Early or Late] = 1, "On Time",
    [Days Early or Late] = -1, "On Time",
    ISBLANK ( [Days Early or Late] ), "On Order",
    [Days Early or Late] = 0, "On Time",
    "Other"
)

 

If that doesn't work, there may be a deeper issue going on with auto-exists.

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.