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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
ZachUnger
Helper II
Helper II

Type text to Type Number

Hi Team 

 

I'm trying to create a column to show "over 24 hours as text for the below query but keep getting an error of "Cannot convert value 'Over 24 Hours' of type Text to type Number".

 

Can someone help with this? 

IF(DATA[HrsBtwRecievedandAssigned] <= VALUE("0" ), VALUE("0"),
  IF(DATA[HrsBtwRecievedandAssigned] <= VALUE("2" ), VALUE("2"),
  IFDATA[HrsBtwRecievedandAssigned] <= VALUE("24" ), VALUE("24"),
  IF(DATA[HrsBtwRecievedandAssigned] >= VALUE("24" ), VALUE("Over 24 Hours")
  ))))
 
Please and thank you 🙂
Zach 
2 ACCEPTED SOLUTIONS

Thanks, doing that then gives me the below error...

Cannot convert value 'Over 24 Hours' of type Text to type Integer.

View solution in original post

Anonymous
Not applicable

Hi @ZachUnger ,

 

Please try.

Column = 
SWITCH(
    TRUE(),
    'DATA'[HrsBtwRecievedandAssigned]<=0,"0",
    'DATA'[HrsBtwRecievedandAssigned]<=2,"2",
    'DATA'[HrsBtwRecievedandAssigned]<=24,"24",
    "Over 24 Hours"
)

vcgaomsft_0-1679901580891.png

In desktop please make sure the final output type is the same.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @ZachUnger ,

 

Please try.

Column = 
SWITCH(
    TRUE(),
    'DATA'[HrsBtwRecievedandAssigned]<=0,"0",
    'DATA'[HrsBtwRecievedandAssigned]<=2,"2",
    'DATA'[HrsBtwRecievedandAssigned]<=24,"24",
    "Over 24 Hours"
)

vcgaomsft_0-1679901580891.png

In desktop please make sure the final output type is the same.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

HotChilli
Super User
Super User

@ZachUnger help me to help you please.

Post some simple sample data and the code for your column now and i'll have a look

HotChilli
Super User
Super User

Value "Converts a text string that represents a number to a number" so it's going to error on this : VALUE("Over 24 Hours").

If you want a text column, I think you can remove the VALUE from all return clauses.  That's without testing so see how you get on  

Thanks, doing that then gives me the below error...

Cannot convert value 'Over 24 Hours' of type Text to type Integer.

Helpful resources

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