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
RPAI2812
Helper I
Helper I

Replace values based on function

Hi, I have a column from a table that the database is not following a standard as from picture below. I need to have the time information in hours as a number, but the person that fills the database sometime fills with strings such as "h" for hours and "min" for minutes. I would like to create a function in PQ that transforms these cases of texts to the correct number value. In other words, I would like to change "h" for a comma, erase the word num and the value of minutes I would have to divide by 60 to have its decimal values in hours.

 

I am not very much familiar with coding in PQ, so I kindly ask someone's help 🙂

 

RPAI2812_0-1634910506837.png

 

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@RPAI2812  in PQ replace "h" with comma(,) and then split on first delimiter (,)

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

2 REPLIES 2
smpa01
Super User
Super User

@RPAI2812  in PQ replace "h" with comma(,) and then split on first delimiter (,)

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
RPAI2812
Helper I
Helper I

An additional relevant information is that I don't have access to edit the database

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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