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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Grouping values

Hi guys,

 

i have a table with yearly product revenue and the launch year of those products: 

 

Unbenannt.PNG

 

So you see for 2018, 2019, 2020 the percentag of the total revenue that comes from products that have been launched in either 2017, 2018, 2019, 2020. 

 

Now i want to group the launch years differently. In the graph i only want to show two groups.

 

1) Products <= 2 years old

 

2) Products > 2 years old

 

So for 2020 revenue the graph should group products launched in 2020 and 2019 in group 1) the rest in group 2). For 2019 -> 2019, 2018 in group 1) rest in group 2). 

 

How can i achieve that with a measure?

 

Thx guys!

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

You could try this way as below:

Step1:

Add a calculate column as below:

Group = IF('Table'[launchdate]='Table'[Year Sale]||'Table'[launchdate]+1='Table'[Year Sale],"group 1","group 2")

Step2:

Then when you create the visual, use the new column [Group] instead of [launchdate]

Result:

5.JPG

 

Regards,

Lin

 

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

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

You could try this way as below:

Step1:

Add a calculate column as below:

Group = IF('Table'[launchdate]='Table'[Year Sale]||'Table'[launchdate]+1='Table'[Year Sale],"group 1","group 2")

Step2:

Then when you create the visual, use the new column [Group] instead of [launchdate]

Result:

5.JPG

 

Regards,

Lin

 

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

Works perfectly thanks!

amitchandak
Super User
Super User

@Anonymous ,

Refer if these can help

https://www.daxpatterns.com/static-segmentation/

https://www.daxpatterns.com/dynamic-segmentation/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@Greg_Deckler Thanks for the info. I read it and uploaded the sample file here to see the simplified datastructure i have: 

 

https://wetransfer.com/downloads/e56d65f170ff282ed1ded258de36ca7820200507152052/0d5744d4bdaf2532a375...

 

@amitchandak Thanks for the link. I'm going through but can't really relate it to my problem. Any ideas may be with the example file i posted?

Greg_Deckler
Community Champion
Community Champion

That would depend on you data and your formulas how you would achieve that. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors