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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.