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
Anonymous
Not applicable

Automatic grouping data by range

I have manually grouped the data as seen in the below screenshots. 

 

Is there a way to automatically group this data so I do not have to go back and edit every time new data is added into my dataset?

 

i.e every time data is added in the range of 250K-680K it will be automatically grouped under the range 250K-680K. Please see below screenshots. 

 

christianadaa_0-1653448592701.png

christianadaa_1-1653448643650.png

 

@Nathaniel_C - you were a brilliant help in my previous post re data ordering- i would be greatly appreciative if you have any insight to this issue i am facing 

 

1 ACCEPTED SOLUTION

Hi,

Create a table like this and name it Buckets

Lower Upper Bracket
0           30,000 0 - 30K
        30,000        2,50,000 30 - 250K
     2,50,000        6,80,000 250 - 680K
     6,80,000      10,00,000 680K - 1M
    10,00,000  10,00,00,000 > 1M

Write this calculated column formula

Column = CALCULATE(MAX(Buckets[Bracket]),FILTER(Buckets,Buckets[Lower]<='Table'[original contract value]&&Buckets[Upper]>='Table'[original contract value]))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

14 REPLIES 14
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of your PBI file and clearly show the grouping that you want to create.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish, 

 

Thank you for your response. 

 

I can not share the download link due to privacy reasons. 

 

Please see my above reply that includes more detail re your request. Otherwise I am happy to provide more information if you specifiy. 

 

Thank you, 

Christiana

Hi,

Anonymise your data and share the download link of that file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish, 

 

Thank you.

 

I have checked with my organisation and unable to share data even if it is anon. 

 

Please see below screenshots of the data. 

 

First, I created a range in power query. 

Original: 

christianadaa_1-1654144934478.png

Range: 

christianadaa_0-1654144826515.png

 

Then, I manually grouped this range into groups. 

christianadaa_2-1654145029719.png

 

My goal is to make this grouping automatic insteaf of manually dragging it. The manual process is captured below. 

christianadaa_3-1654145083963.png

 

I hope there is a way!

 

Christiana

 

 

I cannot help without a file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish, 

 

Thank you. Please see file attached. 

 

I would like too create groups for the column 'original contract value (groups)' that reflect the ranges in the pie chart below. These groups will be auto-updated instead of manually updated in the pie graph. Is this possible? 

christianadaa_0-1655686713569.png

 

How do I attach a file to this thread? 

 

Christiana

Hi,

Upload the file to Google Drive and share the download link.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi,

Create a table like this and name it Buckets

Lower Upper Bracket
0           30,000 0 - 30K
        30,000        2,50,000 30 - 250K
     2,50,000        6,80,000 250 - 680K
     6,80,000      10,00,000 680K - 1M
    10,00,000  10,00,00,000 > 1M

Write this calculated column formula

Column = CALCULATE(MAX(Buckets[Bracket]),FILTER(Buckets,Buckets[Lower]<='Table'[original contract value]&&Buckets[Upper]>='Table'[original contract value]))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you so much for your response. 

 

I tried to imitate this and recieved the error 'Token Literal expected' - the error is with 'Table' where the grey highlight and red mark is in the second screesnhot. Please see below. screenshots? 

 

christianadaa_0-1655784891287.png

christianadaa_1-1655784986034.png

 

What is incorrect on my end? 

Hi,

Mine is a calculated column formula to be written in the Data Model (not an M language code to be written in the Query Editor). 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you very much. 

 

This worked so well. I have applied it to my main report. 

 

Just to confirm - this formula is only using the original contract value column and not the (groups) column? 

 

Christiana

You are welcome.  That is correct.  


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you very much!

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!

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.