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

How to make Contribution to Growth formula

Hi,

 

 

I want to calculate a measure where I sum up the growth of all products that have growth vs. last year and in another measure, I want to aggregate the decline of all the products that have a decline. 

 

I've tried with

Growth=If([This Year] > [Last year]; [This Year]-[Last Year]) 

Decline=If[This Year]<[Last year];[This Year]-[Last Year])

 

It works on an aggregated level but it sums up the whole year and not per product. I would like to see both how much that is growth and how much that is decline...

 

Hope you can help

 

 

 

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

You can create a calculated column like below to get values in last year same weeknr for the same product:

 

LastYearSameSKU-WEEKNR = LOOKUPVALUE(data[Value Sales'000],data[PRODUCT],'data'[PRODUCT],data[WEEKNR],'data'[WEEKNR],data[YEAR],'data'[YEAR]-1)

 

Best Regards,
QiuyunYu

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

6 REPLIES 6
Greg_Deckler
Super User
Super User

Add Product to your visual?


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

Thanks, @Greg_Deckler, I wished it was that simple - The visualization I use is a Stacked Column where I have growth, decline and value last year in three different column values and then Value this year in a Line, The 3 columns add up to this year's value.

 

When I have more than one value in Column values I cannot have anything in Column series...

 

image.png

 

 

 

 

 

 

 

 

 

 

 

 

On the chart above I should have both growths and decline in each period - Now I only have the net growth or decline.

 

In Excel I can fix it, so it should look something like this:

 

image.png

Hi @Anonymous,

 

It's expected that we can't add column to Column Series property if we already add more than one fields into Column Values section.

 

In your scenario, please share some sample data and show us the desired results, so we can test to see if your requirement can be achieved.

 

Best Regards,
QiuyunYu

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

Thanks for coming back @v-qiuyu-msft.

 

You can find some data here:

https://www.dropbox.com/sh/vtld3ulkzqmi1ym/AAAxsCvX1DDnCa20e4WVsZ-0a?dl=0

 

I have been thinking - if I can add a column in the table that looks up last years sales on each SKU, Year, Period it should be easy. There is only one row per SKU/Period....

 

Thanks for looking into this!

 

Kent

Hi @Anonymous,

 

You can create a calculated column like below to get values in last year same weeknr for the same product:

 

LastYearSameSKU-WEEKNR = LOOKUPVALUE(data[Value Sales'000],data[PRODUCT],'data'[PRODUCT],data[WEEKNR],'data'[WEEKNR],data[YEAR],'data'[YEAR]-1)

 

Best Regards,
QiuyunYu

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

Thank you very much @v-qiuyu-msft - It worked perfectly!

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.