cancel
Showing results 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.

New Member

## Error for if statement

Hi Guys,
So I'm fairly new to this and would like some help over here.
For my dataset I created a column Age with randbetween function and values from 10 to 28. So this column is formed correctly. Now I wanted to create another column and divide these ages into groups like 10-12 should be kids, 13-19 should be teens, and rest should be adults.
Normally I would create a conditional column but the section doesnt show the column Age and I'm guessing thats because I used the randbetween function which is ok so I tried to do it by creating a new column by

Age group = IF('Sheet1 (2)'[Age]>=10,'Sheet1 (2)'[Age]<=12,"Kids") & IF('Sheet1 (2)'[Age]>12,'Sheet1 (2)'[Age]<=19,"Teens")& IF('Sheet1 (2)'[Age]>=20,"Adults")
Still getting some errors.

Any help will be appreciated!
TIA.
1 ACCEPTED SOLUTION
New Member

Turns out if and, if and and if works perfectly

Age group = IF(AND('Sheet1 (2)'[Age]>=10,'Sheet1 (2)'[Age]<=12),"Kids") & IF(AND('Sheet1 (2)'[Age]>12,'Sheet1 (2)'[Age]<=19),"Teens")& IF('Sheet1 (2)'[Age]>=20,"Adults")

New Member

Turns out if and, if and and if works perfectly

Age group = IF(AND('Sheet1 (2)'[Age]>=10,'Sheet1 (2)'[Age]<=12),"Kids") & IF(AND('Sheet1 (2)'[Age]>12,'Sheet1 (2)'[Age]<=19),"Teens")& IF('Sheet1 (2)'[Age]>=20,"Adults")

Announcements

#### 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

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors