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
reportuser
Helper II
Helper II

Cannot Convert value of type Text to type Integer: Creating a Slicer Dropdown

I have a column of Total Duration in seconds and I am trying to create a column called, "Label" which I want to turn into a Dropdown Slicer. I get the error code of, "Cannot conver value 'Less than 300" of type Text to type Integer

 

 

Total Duration DropDown = 
SWITCH(
    TRUE(),
    [Total Duration] <= 300, "Less than 300",
    [Total Duration] <= 400, "Less than 400",
    [Total Duration] <= 500, "Less than 500"
)

 

 

Total DurationLabel
99Less than 100 seconds
7Less than 100 seconds
523Less than 600 seconds
388Less than 400 seconds
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@reportuser , This code seems fine, hope Total Duration is a column and number type

 

Can you a sample pbix after removing sensitive data.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@reportuser , This code seems fine, hope Total Duration is a column and number type

 

Can you a sample pbix after removing sensitive data.

@amitchandak, The label is a column and it was whole number which caused the error. Once I changed the Label Column to Data Type, "Text" the formula worked.

Your question actually provided the solution. Thank you 🙂

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.