cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
OH Frequent Visitor
Frequent Visitor

easy way to categorize data based on ranges

I am quite new to PowerBI and all the big data mining stuff.

Yet since some weeks I am trying to ramp my knowledge up.

 

When typing the subject I looked up all the proposes articles but non was the answer to my (probale easy) usecase.

 

I am analysing our CAD-Data and have e.g. a column that lists the Volume of a body in the CAD-Data

Now I want to categorize the Data in the sense of:

Volume

01: 0-0.1 l

02: 0.1-0.2 l

03: 0.2-0.5 l

04: 0.5-1.0 l etc. (I guess you get the idea, don't be too strict about >, >=, etc.)

 

First I tried to do a calulation but I soon gave up when confronted with the M syntax necessary.

I realized I am not a software engineer guy at all 😉

 

Currently I found the Query Editor function "Conditional Column" to fulfill my needs quite well.

 But I wonder if there is a more easy or comprehensive way.

E.g. the ranges 0-0.1, 0.1-0.2 might be "re-usable" for other dimensions (e.g. mass, length) as well.

Right now I am clicking/typing 10 lines each times I create a new Cond. Column for another.

 

Any hints (if not too deep "coded") are welcome

1 ACCEPTED SOLUTION

Accepted Solutions
v-danhe-msft Super Contributor
Super Contributor

Re: easy way to categorize data based on ranges

Hi @OH,

Based on my test, you could refer to below steps:

Sample data:

1.PNG

Create a calculated column:

Type = IF('Table1'[Value]<=0.1,1,
         IF('Table1'[Value]<=0.2,2,
         IF('Table1'[Value]<=0.5,3,
         IF('Table1'[Value]<=1,4))))

2.PNG

IF you want to adapt to the other column, just modify the column name in the formula(see the [Value] changed to the [Length]).

Type2 = IF('Table1'[Length]<=0.1,1,
         IF('Table1'[Length]<=0.2,2,
         IF('Table1'[Length]<=0.5,3,
         IF('Table1'[Length]<=1,4))))

3.PNG

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/vhcq8xr3p64fodm/easy%20way%20to%20categorize%20data%20based%20on%20ranges....

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-danhe-msft Super Contributor
Super Contributor

Re: easy way to categorize data based on ranges

Hi @OH,

Based on my test, you could refer to below steps:

Sample data:

1.PNG

Create a calculated column:

Type = IF('Table1'[Value]<=0.1,1,
         IF('Table1'[Value]<=0.2,2,
         IF('Table1'[Value]<=0.5,3,
         IF('Table1'[Value]<=1,4))))

2.PNG

IF you want to adapt to the other column, just modify the column name in the formula(see the [Value] changed to the [Length]).

Type2 = IF('Table1'[Length]<=0.1,1,
         IF('Table1'[Length]<=0.2,2,
         IF('Table1'[Length]<=0.5,3,
         IF('Table1'[Length]<=1,4))))

3.PNG

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/vhcq8xr3p64fodm/easy%20way%20to%20categorize%20data%20based%20on%20ranges....

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

OH Frequent Visitor
Frequent Visitor

Re: easy way to categorize data based on ranges

Hello Daniel

 

Thank you as well for the explanations. Someone else has already answered my other post but you open another way of solution.

I will try both and see what is easier.

 

Best regards

Olaf

 

v-danhe-msft Super Contributor
Super Contributor

Re: easy way to categorize data based on ranges

Hi @OH,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 374 members 4,064 guests
Please welcome our newest community members: