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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

undefined

Hi, I have a column in direct query mode which is of type string. I cannot change the data type of the column.

 

The column has two values, either a number or null.

How can I create a DAX measure which checks the value and if its a number then retain the same,else if its a null then consider it as 0?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Try VALUE function. It converts a text string that represents a number to a number.

Measure = VALUE(MAX('Table_2'[num]))+0

Screenshot 2021-05-13 144425.png

 

I use DirectQuery to connect SQL Server.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Try VALUE function. It converts a text string that represents a number to a number.

Measure = VALUE(MAX('Table_2'[num]))+0

Screenshot 2021-05-13 144425.png

 

I use DirectQuery to connect SQL Server.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

PaulDBrown
Community Champion
Community Champion

@Anonymous 

Create a measure along the lines of:

Measure 1 = SUM(Table[column]) + 0





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

The column is of type Text/String so SUM wont work right

 

@Anonymous 
Try:

Measure 1 = IF(ISBLANK(MAX(Table[Column])), 0, MAX(Table[Column]))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors