Growth vs 2019 test =
var _year = [SelectedYear]
var flag_Italy =
IF(
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Italy")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Italy")) > 0 &&
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = 2019 , FILTER(dim_product, dim_product[Country] = "Italy")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Italy")) > 0,
1,
BLANK()
)
var flag_Germany =
IF(
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Germany")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Germany")) > 0 &&
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = 2019 , FILTER(dim_product, dim_product[Country] = "Germany")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Germany")) > 0,
1,
BLANK()
)
var flag_France =
IF(
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "France")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "France")) > 0 &&
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = 2019 , FILTER(dim_product, dim_product[Country] = "France")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "France")) > 0,
1,
BLANK()
)
var flag_Spain =
IF(
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Spain")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Spain")) > 0 &&
NOT(ISBLANK(CALCULATE([Sellout], dim_period[Year] = 2019 , FILTER(dim_product, dim_product[Country] = "Spain")))) || CALCULATE([Sellout], dim_period[Year] = _year , FILTER(dim_product, dim_product[Country] = "Spain")) > 0,
1,
BLANK()
)
var total_sellout_2019 =
CALCULATE(
[Sellout],
dim_period[Year] = 2019,
ALL(dim_period[Week date]),
(dim_product[Country] = "Italy" && flag_Italy = 1) ||
(dim_product[Country] = "Germany" && flag_Germany = 1) ||
(dim_product[Country] = "Spain" && flag_Spain = 1) ||
(dim_product[Country] = "France" && flag_France = 1)
)
var total_sellout_2024 =
CALCULATE(
[Sellout],
dim_period[Year] = _year,
ALL(dim_period[Week date]),
(dim_product[Country] = "Italy" && flag_Italy = 1) ||
(dim_product[Country] = "Germany" && flag_Germany = 1) ||
(dim_product[Country] = "Spain" && flag_Spain = 1) ||
(dim_product[Country] = "France" && flag_France = 1)
)
return
IF(
ISBLANK(total_sellout_2019) || total_sellout_2019 = 0 || ISBLANK(total_sellout_2024) || total_sellout_2024 = 0,
BLANK(),
DIVIDE(
total_sellout_2024,
total_sellout_2019
) - 1
)
==================================================================
sellout = SUM(Sellout_Value)