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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
powerbidev123
Solution Sage
Solution Sage

Conversion issue from text to integer

I have column YOB which has data type text. it has some blank values and whole number values . When I try converting the column to whole number I get an error which says cant convert '' to integer. I want to convert it to integer as I want to perform mathematical operation using this column. Any suggestion as to how I can convert the blank values to number as well

powerbidev123_0-1730707093076.png

I tried replacing the blank values with 0 but still getting an error which is posted below:

 

 

powerbidev123_1-1730707348516.png

 

And I need a calculated column because I cant do any changes in power query model as the data source is an online one and any changes in the structure in power query will cause an error the next time data is refreshed.

 

2 ACCEPTED SOLUTIONS
aduguid
Super User
Super User

Try this one

 

YOB = 
VAR DOB = Query1[Date of Birth]
RETURN IF(
    ISBLANK(DOB) || DOB = "", 
    0, 
    VALUE(MID(DOB, 7, 4))
)

View solution in original post

Thanks a lot!! It worked 🙏 . This was the catch that I missed ISBLANK(DOB) || DOB = ""

View solution in original post

2 REPLIES 2
aduguid
Super User
Super User

Try this one

 

YOB = 
VAR DOB = Query1[Date of Birth]
RETURN IF(
    ISBLANK(DOB) || DOB = "", 
    0, 
    VALUE(MID(DOB, 7, 4))
)

Thanks a lot!! It worked 🙏 . This was the catch that I missed ISBLANK(DOB) || DOB = ""

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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