@Thimos,
I would take a very different approach here, just measure branching off revised versions of the
Quantity 2020 and Quantity 2021 measures. With regard to these measures, I’ve revised them as follows - generally speaking, you should aggregate on your fact tables and filter on your dimension tables. Thus, I’m filtering on the YEAR from the Date table, not the Supplies table.
Quantity 2020 =
CALCULATE(
SUM('Supplies'[ΠΟΣ]),
FILTER(
ALL( 'Date' ),
'Date'[Calendar Year] = 2020
)
)
Note that your Year field was formatted as text, so I had to change this to whole number to get the measure to work.
Now the measure that does most of the heavy lifting is this one:
In 2021 Not 2020 =
IF(
AND(
[Quantity 2021] > 0,
OR(
[Quantity 2020] = BLANK(),
[Quantity 2020] = 0
)
), 1, 0
)
This just evaluates whether an item was bought in 2021 and not in 2020 (allowing for “not bought” to be a blank or a zero), and returns a 1 if both conditions are true, 0 otherwise. Then in the filter pane, you set it to only show records where this measure = 1.
Note that I just included this measure in the table to show you it was working properly - no need to include it in the final report visual, as long as you have the filter pane set as shown.
I hope this is helpful. Full solution file provided below.
P.S. Lots of issues with your data model as well, but they don’t affect the outcome of this calculation. Let me know if you want to discuss those too.
eDNA Forum - Bought in 2021 not 2020 Solution.pbix (4.3 MB)