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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anne14
Frequent Visitor

Need to group values

Hello,

 

I need your help. I have a column with many values from 0 to 200 and I need to group them as following:

If the value is between 0 and 20 in a new column called " Grouped values" I want to dispay as text "0-20", in other one if it is between 20-40 I want to display '20-40" etc. I tried to make a conditionnal column in power query  but there is no option "between" so I can't make more than 2 groups and I need 5. 

Thanks for your help

 

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

@Anne14 ,

 

You can produce the required output by writing a calculated column like the one below:

Bucket = switch(true(),[Value]<=20,"1-20",
[Value]<=40,"21-40",
[Value]<=60,"41-60",
[Value]<=80,"61-80",
[Value]<=100,"81-100",
[Value]<=120,"101-120",
[Value]<=140,"121-140",
[Value]<=160,"141-160",
[Value]<=180,"161-180",
[Value]<=200,"181-200")

The resultant output is the bucketing of numbers as shown below:

DataNinja777_0-1724335781229.png

I have attached an example pbix file.  

Best regards,

 

View solution in original post

2 REPLIES 2
Anne14
Frequent Visitor

@DataNinja777 thank you very much for your help! perfect! have a nice day!

DataNinja777
Super User
Super User

@Anne14 ,

 

You can produce the required output by writing a calculated column like the one below:

Bucket = switch(true(),[Value]<=20,"1-20",
[Value]<=40,"21-40",
[Value]<=60,"41-60",
[Value]<=80,"61-80",
[Value]<=100,"81-100",
[Value]<=120,"101-120",
[Value]<=140,"121-140",
[Value]<=160,"141-160",
[Value]<=180,"161-180",
[Value]<=200,"181-200")

The resultant output is the bucketing of numbers as shown below:

DataNinja777_0-1724335781229.png

I have attached an example pbix file.  

Best regards,

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.