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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.