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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
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
Super User
Super User

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


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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