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

Remove/replace cells that contain only minus symbol, keep numbers

We have "dirty" data, where some cells represent zero values as "-" and some as just 0. 

 

yzahrkov_0-1623768003730.png

 

Power Query can't convert columns with "-" into Numeric data type and throw errors in Query. Ideally I have to replace cells that contain only "-" and "    -" with zero. 
 I can't turn columns into text values and remove "-" symbol: then I would have negative values turned to positives, "-84.21" to "84.21". Do you have an idea how to overcome this? 

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

You can use the Text.End function to replace "-" and "-", then even if you convert the column to text format will not affect the negative value.

Steps:

Convert column into text:

vxulinmstf_0-1623917600879.png

Add custom column as:

if Text.End([Value],1)="-"
then 0
else [Value]

vxulinmstf_1-1623917678598.png

The pbix is attaached.

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous,

 

Is your issue solved?

If the issue has been solved, please adopt the solution to help others.

If you still have some question, please don't hesitate to let me known.‌‌

😉

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

You can use the Text.End function to replace "-" and "-", then even if you convert the column to text format will not affect the negative value.

Steps:

Convert column into text:

vxulinmstf_0-1623917600879.png

Add custom column as:

if Text.End([Value],1)="-"
then 0
else [Value]

vxulinmstf_1-1623917678598.png

The pbix is attaached.

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

amitchandak
Super User
Super User

@Anonymous , remove space, and if you are left out only with - , in that case you can create new column and you can check for value = -

 

if [col] = "-" then null else [col]

 

change datatype to number

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.