A measure calculating two different cumulative totals
I need a measure that will calculate two different cumulative totals depanding on one of the column values.
The below table contains a sample data set. The Date column is connected to a Calendar table in my model. For the following set I need to write a measure that will:
1) for Country=Poland calculate YTD cumulative total of Amount
2) for Country=UK calculate lifetime to date total of Amount. The following measure correctly calculates such a lifetime to date total but I don't know how to combine it in a single measure with the condition from point 1: CALCULATE(SUM[Amount];FILTER(ALL('Calendar'[Date]);'Calendar'[Date]<=MAX('Calendar'[Date])))
no I am afraid it is not working the way I wanted it to work. Below is a complete measure code. I am testing it in Power Pivot that's why there is IF instead of SWITCH. It seems to me that the IF test always fails and therefore the false part of the if statement is always executed.
If the code was correct 2 should be returned for Gdansk, since there is only one entry for Gdansk with the date in 2019 (second row of the source table) - please notice that I have changed the amounts in the sample table for simplicity reasons.