I have a table with quarterly volume data, and a slicer that allows you to choose what quarter/year you want to see volume per code for. The slicer has 2019Q1 through 2021Q4 selections. I need to create dynamic difference column that will adjust depending on what quarter/year is selected in the slicer. I know I need to create a new measure using Calculate/filter but am a beginner in PowerBI and am unsure how to write that formula.
Example of raw table data:
Code | 2019Q1 | 2019Q2 | 2019Q3 | 2019Q | 2020Q1 | 2020Q2 | 2020Q3 | 2020Q4 |
---|---|---|---|---|---|---|---|---|
11111 | 232 | 283 | 289 | 19 | 222 | 283 | 289 | 19 |
22222 | 117 | 481 | 231 | 31 | 232 | 286 | 2 | 19 |
11111 | 232 | 397 | 94 | 444 | 232 | 553 | 0 | 188 |
22222 | 117 | 411 | 15 | 14 | 232 | 283 | 25 | 189 |
Example if 2019Q1 and 2020Q1 are selected:
Code | 2019Q1 | 2020Q1 | Difference |
---|---|---|---|
11111 | 232 | 222 | 10 |
22222 | 117 | 481 | -364 |
11111 | 232 | 397 | -165 |
22222 | 117 | 411 | -294 |