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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ovetteabejuela
Impactful Individual
Impactful Individual

PowerQuery: Replace Value (Dashes)

Hi Again,

 

I'm trying to replace a value - a DASH particularly. It works, however it also does remove the dash symbol for negative numbers. How do I prevent M from doing that?

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

Hi @ovetteabejuela,

 

Is the negative number part of a longer peice of text? 

 

Could you create a custom column to preserve the negative number before cleaning your original column?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
MrPowerQuery
New Member

Transform the number to text and replace the dash "-" with "-0". After this convert the column to a number. The "-0" will be converted to 0 and all other numbers will remain the same, since adding a "0" in front of a number will not affect the value of it.

Phil_Seamark
Employee
Employee

Hi @ovetteabejuela,

 

Is the negative number part of a longer peice of text? 

 

Could you create a custom column to preserve the negative number before cleaning your original column?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark, thanks I actually did resort to that solution store (1,-1) in a separate column prior to removing dashes. I hope there was an option to tick to exclude dashes that precedes a number though - an out-of-the-box solution.

 

Thanks.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.