Forum Discussion
How do I get the difference between concepts using one as baseline?
I have this set of data in a matrix:
2017Q4 2018Q1 2018Q2 2018Q3 2018Q4 2019Q1 2019Q2 2019Q3
| Sell-out | 1,212,945 | 1,137,895 | 924,648 | 1,036,562 | 1,234,706 | 1,145,306 | 898,775 | 966,646 |
| Sell-through | 689,881 | 823,323 | 635,203 | 540,744 | 576,637 | |||
| Shipment | 1,445,852 | 1,191,056 | 944,553 | 1,169,160 | 1,346,823 | 1,069,495 | 911,682 | 1,098,128 |
I would like to know the difference for each Q for Sell-Out and Sell-through vs Shipment. In excel I would only have to choose "show values as difference from" and select Shipment concept as the baseline and get something like this:
2017Q4 2018Q1 2018Q2 2018Q3 2018Q4 2019Q1 2019Q2 2019Q3
| Sell-out | 1,212,945 | 1,137,895 | 924,648 | 1,036,562 | 1,234,706 | 1,145,306 | 898,775 | 966,646 |
| Sell-through | 689,881 | 823,323 | 635,203 | 540,744 | 576,637 | |||
| Shipment | 1,445,852 | 1,191,056 | 944,553 | 1,169,160 | 1,346,823 | 1,069,495 | 911,682 | 1,098,128 |
| Sell-out | -232,907 | -53,161 | -19,905 | -132,598 | -112,117 | 75,811 | -12,907 | -131,482 |
| Sell-through | -1,445,852 | -1,191,056 | -944,553 | -479,279 | -523,500 | -434,292 | -370,938 | -521,491 |
| Shipment |
Is there a formula I can use to replicate this same process?
Try this solution.
1. Structure the data like this (you can use Unpivot in Power Query if each Period is a column in the original data):
2. Create a disconnected table "Types". Sort the Type column by the Index column. No relationship exists between these two tables.
3. Create measures:
Sell-out = CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Sell-out" ) Sell-through = CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Sell-through" ) Shipment = CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Shipment" ) Sell-out vs Shipment = [Sell-out] - [Shipment] Sell-through vs Shipment = [Sell-through] - [Shipment] Type Switch = SWITCH ( SELECTEDVALUE ( Types[Type] ), "Sell-out", [Sell-out], "Sell-through", [Sell-through], "Shipment", [Shipment], "Sell-out vs Shipment", [Sell-out vs Shipment], "Sell-through vs Shipment", [Sell-through vs Shipment] )4. Create matrix:
1 Reply
- DataInsightsSuper User
Try this solution.
1. Structure the data like this (you can use Unpivot in Power Query if each Period is a column in the original data):
2. Create a disconnected table "Types". Sort the Type column by the Index column. No relationship exists between these two tables.
3. Create measures:
Sell-out = CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Sell-out" ) Sell-through = CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Sell-through" ) Shipment = CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Shipment" ) Sell-out vs Shipment = [Sell-out] - [Shipment] Sell-through vs Shipment = [Sell-through] - [Shipment] Type Switch = SWITCH ( SELECTEDVALUE ( Types[Type] ), "Sell-out", [Sell-out], "Sell-through", [Sell-through], "Shipment", [Shipment], "Sell-out vs Shipment", [Sell-out vs Shipment], "Sell-through vs Shipment", [Sell-through vs Shipment] )4. Create matrix: