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
qsong
Helper II
Helper II

Convert string to number in DAX Function

Hello Community,

 

I connected to the source data through the online mode of the AAS model in Power BI, so I am not able to change formats of the datasets using the conventional ways (power query, for instance). Before doing the calculation, I need to convert the string to numerical value. For that, I used "Format", "value", or "convert", none of them worked for me because I cannot find the column in those formulas. For example, I have a string column "201908" and want to convert a value of 201908. Thank you.

2 ACCEPTED SOLUTIONS

@qsong - Use MAX or MIN



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Finally I used VALUE(MAX()) to refer the column names, and it works for me.

 

Thank you.

View solution in original post

9 REPLIES 9
Greg_Deckler
Community Champion
Community Champion

@qsong - Try [Column] * 1



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler,

Thank you for your suggestion.

 

I cannot find the column except I have to add something like sum before the column; However, column has a string value, so sum does not work on the case.

 

Best, Qianru 

@qsong - Use MAX or MIN



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg,

 

I need to convert 123-45-789-0 is kind of string format data to number format ,could you please help me .

 

I need to logic to get additional values result 

For example,

 

 AI        Col-A    Col-B   Result

 A         123.     123.       Equal

 A         123.                  Extra 

 

I need to get extra for same document A

 

 

 

 

 

Finally I used VALUE(MAX()) to refer the column names, and it works for me.

 

Thank you.

@qsong , are you using live connection? Otherwise, you can simply change the data type to the number and it should work as long as all values in the column are 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

I am using the live connection. So I cannot use power query to make the change.

Hi @qsong ,

 

Can you share the screenshot of your table and the column you want to convert.

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @harshnathani,

 

I have a string column called calendar_month_key, and I want to convert it to be a numerical column called PP. As I described the background before, I am not able to do the format conversion in power query or by creating a calculated column because of the particular source connection. 

 

qsong_0-1599572561930.png

Currently, I am using the conditional statement for the conversion which consumes a lot of memory. So I cannot have enough space for further calculation. 

 

Thank you.

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.