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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cannot convert value " of type Text to type Integer

I'm importing data into Power BI and I have "Duration" column which stores duration in seconds. I want to convert it to minutes so I've created a new column and used the following function:

ROUNDUP (mytable[Duration]/60,0)

This function works in my other report. However, it doesn't work in my new report: I'm getting "Cannot convert value " of type Text to type Integer" error. I suspect that this is due to some blank data in Duration column.

I've tried removing blank data by using filtering in power query: power query >> click on Duration table >> filter >> remove empty.

I've also tried to replace blank data: power query>> transform >> replace values >> find "blank" and "null" >> replace with 0. Both methods don't work and I'm still getting error message.

Any ideas, please?

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

That must be mytable[Duration] is a text column, means there must be some text format value in it.

Please change the data type of this column into number as below:

5.JPG

Then you filter which row is error.

6.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
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
E0657198
New Member

Hi,

 

I am also facing this issue, Any help is greatly appreciated! 

 

Mileage = IF(CALCULATE(FIRSTNONBLANK('Requested_VIN List'[Mileage],1),FILTER(ALL('Requested_VIN List'),'Requested_VIN List'[VIN]='Fleet Ref_VIN_List'[VIN]))="","-",CALCULATE(FIRSTNONBLANK('Requested_VIN List'[Mileage],1),FILTER(ALL('Requested_VIN List'),'Requested_VIN List'[VIN] ='Fleet Ref_VIN_List'[VIN])))
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

That must be mytable[Duration] is a text column, means there must be some text format value in it.

Please change the data type of this column into number as below:

5.JPG

Then you filter which row is error.

6.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for your tip @v-lili6-msft! I've changed the data type to decimal number in power query editor and I didn't get any errors but I had some blanks, which I removed in filter >> remove empty.

My new column is now working as expected.

HotChilli
Super User
Super User

You could use the column quality and distribution features under the View menu in Power Query to have a look at your data.  You should be able to find the dodgy values that way.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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