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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
RichardJ
Responsive Resident
Responsive Resident

SWITCH assuming a blank numeric column is zero - need help with syntax

Apologies for the rookie question but I cant figure out the correct syntax to generate values in a new column.

I think the issue I am having is due to the switch function identifying a Blank numeric column as being a zero value rather than being empty.

 

I have a numeric column which i'd like to apply criteria to as follows:

 

If the DrawingSet[Duration between Forecast and Approval] value is greater than zero then apply the "Delivered Early" value to the column.

If the DrawingSet[Duration between Forecast and Approval] value is equal to zero then apply the 'Delivered On Time" value to the column.

If the DrawingSet[Duration between Forecast and Approval] value is less than zero then apply the "Delivered Late" value to the column.

If the DrawingSet[Duration between Forecast and Approval] column is empty then apply the "No Data" value to the column

 

The column value is

 

Forecast Accuracy =

IF(DrawingSet[Duration between Forecast and Approval] <> BLANK(),
SWITCH(
TRUE(),
DrawingSet[Duration between Forecast and Approval] >0, "Delivered Early",
DrawingSet[Duration between Forecast and Approval] =0, "Delivered On Time",
DrawingSet[Duration between Forecast and Approval] <0, "Delivered Late"
),
"No Data")
 
The problem with the statement above is that it is applying "No Data" to the entries which should be "Delivered On Time"
 
I've tried this column value also:
Forecast Accuracy =
SWITCH(
TRUE(),
DrawingSet[Duration between Forecast and Approval] >0, "Delivered Early",
DrawingSet[Duration between Forecast and Approval] =0, "Delivered On Time",
DrawingSet[Duration between Forecast and Approval] <0, "Delivered Late"
)
 
The problem with this statement is that 'Delivered On Time' is applied to 'Blank' columns which is incorrect.
 
If possible i'd like to keep the column as numeric as it's used on lots of charts.
 
Any help would be appreciated!
Thanks,
Richard
1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@RichardJ 

maybe this

Forecast Accuracy =
SWITCH(
TRUE(),
ISBLANK(DrawingSet[Duration between Forecast and Approval]), "No Data",
DrawingSet[Duration between Forecast and Approval] >0, "Delivered Early",
DrawingSet[Duration between Forecast and Approval] =0, "Delivered On Time",
DrawingSet[Duration between Forecast and Approval] <0, "Delivered Late",
"Undefined"
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

@RichardJ 

maybe this

Forecast Accuracy =
SWITCH(
TRUE(),
ISBLANK(DrawingSet[Duration between Forecast and Approval]), "No Data",
DrawingSet[Duration between Forecast and Approval] >0, "Delivered Early",
DrawingSet[Duration between Forecast and Approval] =0, "Delivered On Time",
DrawingSet[Duration between Forecast and Approval] <0, "Delivered Late",
"Undefined"
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
RichardJ
Responsive Resident
Responsive Resident

Thanks for making my day @az38. That worked perfectly - I wouldn't have worked out that approach.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors