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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Return a value of 0 in a query that includes text.

Hi all,

 

Here is my code:

 

TotalValetSite = Format(FactLots[Total Valet],"#,###") & " total valets this week."
 
 
I sums the number of valet parked cars for the week. As long as we park 1 or more cars it works great!  but when we do not park any cars it returns the following: 
 
"  total valets this week."
 
How do I get this code to return a zero as follows:
"0 total valets this week."
 
Thank you much!
2 ACCEPTED SOLUTIONS

My bad, didn't realize the formatting used in your formula.

Try those suggestions without the Format function to replace the blanks with 0.

Or change your format from ("#,###" to "0,0") and see if that resolves.

 

More on formatting here:

https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings

 

Regards,

Tarun
Did I answer your question? Mark my post as a solution!

View solution in original post

Anonymous
Not applicable

Thank you again, have a nice day!

View solution in original post

4 REPLIES 4
tarunsingla
Solution Sage
Solution Sage

Try this: Add 0 to your [Total Valet] measure.

TotalValetSite = Format(FactLots[Total Valet] + 0,"#,###") & " total valets this week."

 

If that does not work, try the following:

TotalValetSite = Format(IF(FactLots[Total Valet] = BLANK(), 0 , FactLots[Total Valet]),"#,###") & " total valets this week."

 

Regards,

Tarun
Did I answer your question? Mark my post as a solution!

 

Anonymous
Not applicable

Thank you Tarunsingla, however, neither of those options worked 😞

My bad, didn't realize the formatting used in your formula.

Try those suggestions without the Format function to replace the blanks with 0.

Or change your format from ("#,###" to "0,0") and see if that resolves.

 

More on formatting here:

https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings

 

Regards,

Tarun
Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Thank you again, have a nice day!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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