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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
psilos24
Helper I
Helper I

Group values using a measure ?

Hello guys, I would like to ask if it is possible to group values using a measure. I know it is easy through a new column or right-click to the graph and choose the group values. The reason I'm asking is that I haven't access to transform the data and the only option is through the new measure. Any suggestions? 

1 ACCEPTED SOLUTION

@psilos24 
Lets say if you have a column has value from 1-200, you want to group into 4 groups. You can create 4 measures and put them in the Values section.

 

Group 1 = Caluclate(sum([Column]),filter(Table, [column]<=50)
Group 2 = Caluclate(sum([Column]),filter(Table, [column]>50&&[column]<=100)
Group 3 = Caluclate(sum([Column]),filter(Table, [column]>100&&[column]<=150)
Group 4 = Caluclate(sum([Column]),filter(Table, [column]>150&&[column]<=200)

 


Paul Zheng _ Community Support Team
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

7 REPLIES 7
V-pazhen-msft
Community Support
Community Support

@psilos24 

It is not possible to add a measure as chart legend, as measure actually returns a single value.

 

As an alternative, I would suggest you create two separately measures for each group(group 1=> less than 10, group 2 = between 10-20,etc). Then add these two measures into Values section of the chart.


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

@V-pazhen-msft  Thanks for the reply. Can you give me an example of how to create a measure for a group?

@psilos24 
Lets say if you have a column has value from 1-200, you want to group into 4 groups. You can create 4 measures and put them in the Values section.

 

Group 1 = Caluclate(sum([Column]),filter(Table, [column]<=50)
Group 2 = Caluclate(sum([Column]),filter(Table, [column]>50&&[column]<=100)
Group 3 = Caluclate(sum([Column]),filter(Table, [column]>100&&[column]<=150)
Group 4 = Caluclate(sum([Column]),filter(Table, [column]>150&&[column]<=200)

 


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

DataZoe
Microsoft Employee
Microsoft Employee

@psilos24 You could write a measure to do that, but then it would have limited usability, as in you can't put a measure in many places, such as a legend for example. But it would work for a table just fine.

 

Grouping Measure = if(sumx(Table,Table[Value])>1000,"High","Low")

 

If you are really just using a small part of the overall dataset to create a specific report or chart, you could write a query on the data model and then import that in to a new report. Then you can create whatever you want, groups, calculated columns, you name it. I'd suggest connecting to the data model in DAX Studio and writing the query there, typically in the form of EVALUATE(SUMMARIZECOLUMNS(....)).

 

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

@DataZoe Thanks for the reply. Yes, I want to use the measure as a legend if it is possible, and in that way, it can show the bins-groups. Unfortunately, I can't write a query to connect my data model to DAX studio. Any other ideas? 

amitchandak
Super User
Super User

@psilos24 , Can you please explain with an example.

Appreciate your Kudos.

 

refer if these can help

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-po...
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak Thanks for the reply. Please find below a picture from my graph as an example. I want to make bins or groups for the x-axis. I can only use a measure. Any ideas? 

 

 image001.png

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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