Hi, I have data with amount spread across categories by columns and months by rows as listed below. Need help to find the difference from previous month for each product line dynamically for every month run. Appreciate your help on this.
Product | Month | Category A | Category B |
Prod A | 8.2021 | 20 | 30 |
Prod A | 9.2021 | 40 | 50 |
Prod A | 10.2021 | 60 | 40 |
Prod B | 9.2021 | 25 | 40 |
Prod C | 10.2021 | 50 | 80 |
Result should be like below
Product | Month | Category A | Category B |
Prod A | 8.2021 | 20 | 30 |
Prod A | 9.2021 | 40 | 50 |
Prod A | 10.2021 | 60 | 40 |
Prod A | Diff | 20 | -10 |
Prod B | 9.2021 | 25 | 40 |
Prod B | Diff | -25 | -40 |
Prod C | 10.2021 | 50 | 80 |
Prod C | Diff | 50 | 80 |
Solved! Go to Solution.
Hey @JJ523 ,
Here is an example for you. Since you need to get the difference between different rows for multiple columns, we need to use the multi-row + cross tab + transpose configuration in order for that to work.
Best,
Fernando Vizcaino
Hi fmvizciano, thank you for the quick response. Prod A is showing correct difference however, Prod B and C not. Please check and verify
Hey @JJ523 ,
I was missing a group by in the multi-row tool. Also just noticed we don't have the information for the current month in product B, so I've created an additional step to include the most recent month from your dataset for all products (of course, you can remove it later by filtering the values = 0)
Best,
Fernando Vizcaino
You saved my day. Thanks a ton 😀