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.
Hi,
Please I need help with changing age range in text to numbers on Power BI desktop.
The aage column has the following sample ranges:
Total - Age
15 to 24 years
25 to 29 years
I replacec the first "Total - Age" to "0-100" so I can convert the others to numbers. It gave errors. I replaced the "to" into "-".
I replaced "years" with " ". I then tried changing the data type to whole number. It still gave errors. How do I then chenge the column from text type to whole numbers?
Thank you.
@Mariaoye , what is the expected output.
You can have a column like
Switch( True(),
[Total - Age] = "Total - Age" , 0,
left([Age],2)
)
or
left([Age], search(" ",[Age],1,0) -1)
What number do you want exactly? If it's just some number in the range, can you not just extract the first two characters of the field?
Thanks for your response. I want to have a range in numbers that I can use to plot graphs. This is a dataset I got about income and I just want to plot the incomes based on the age ranges.
15-24
25-34.....
Hi @Mariaoye ,
If your expected output is 15-24, 25-34, etc., then how is it going to be whole number? This will always be text datatype.
Also, you can also create groups based on the Age. Right click on age field and create new group.
Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!
@Anand24 Thanks. I guess I was looking at it all wrong.
I can only create categorical fields with range and not numeric. I want to believe that is what you meant.
Cheers.
@Mariaoye,
Yes, that's exactly what i meant. Your range can never be in whole number format.
Thanks for your response. I want to have a range in numbers that I can use to plot graphs. This is a dataset I got about income and I just want to plot the incomes based on the age ranges.
15-24
25-34....
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
101 | |
78 | |
70 | |
64 |
User | Count |
---|---|
140 | |
106 | |
100 | |
83 | |
73 |