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
Vinay06
Frequent Visitor

categorizing based on values

hi,

i am new to dax, in data i have values from 1 to 4753 and i want to categorize data into intervals of 1-7,8-15,16-30,31-60,61-90,90-180,>180. how should i do it? please help meScreenshot (20).png

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Vinay06 ,

 

You can do this in Power Query using Conditional Columns

http://www.plumblineconsulting.com/power-bi-create-buckets-for-continuous-values/

 

else in DAX use this code:

Group Name =
SWITCH (
    TRUE (),
    Table1[column X] >= 180, ">180",
    Table1[column X] < 180
        && Table1[column X] >= 90, "90-180",
    Table1[column X] < 90
        && Table1[column X] >= 61, "61-90",
    Table1[column X] < 60
        && Table1[column X] >= 31, "31-60",
    Table1[column X] < 30
        && Table1[column X] >= 16, "16-30",
    Table1[column X] < 15
        && Table1[column X] >= 8, "8-15",
    "1-7"
)

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

2 REPLIES 2
harshnathani
Community Champion
Community Champion

Hi @Vinay06 ,

 

You can do this in Power Query using Conditional Columns

http://www.plumblineconsulting.com/power-bi-create-buckets-for-continuous-values/

 

else in DAX use this code:

Group Name =
SWITCH (
    TRUE (),
    Table1[column X] >= 180, ">180",
    Table1[column X] < 180
        && Table1[column X] >= 90, "90-180",
    Table1[column X] < 90
        && Table1[column X] >= 61, "61-90",
    Table1[column X] < 60
        && Table1[column X] >= 31, "31-60",
    Table1[column X] < 30
        && Table1[column X] >= 16, "16-30",
    Table1[column X] < 15
        && Table1[column X] >= 8, "8-15",
    "1-7"
)

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

its working,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.

Top Solution Authors