I have 2 dimension tables with no relation between them.
1 is Product Dimension table as
ProdCode | ValidStartDate | ValidEndDate
XX | 2012-01-01| 2016-12-31
XX | 2017-01-01| 2017-12-31
XX | 2018-01-01| 2020-12-31
2nd is Time table
Year | IsCurrent
2012 | 0
2013 | 0
2014 | 0
2015 | 0
2016 | 0
2017 | 0
2018 | 0
2019 | 0
2020 | 1
I need to create a calculated column in Product table to show IsCurrent column from Time Table wrt the year selected.
I tried with CALCULATE but it expects one of the aggregate functions which i can not use because i want to show value in current row context.
for example:
IsCurrent =
CALCULATE(
MAXA('Time'[IsCurrent]),
FILTER(
'Time',
'Time'[Year] >= YEAR(Product[ValidStartDate])
&& 'Time'[Year] <= YEAR(Product[ValidEndDate])
)
)
This always gives me Max value from the range satisfied for example in case of 1st record (2012- 2016) shows 2016 always but I want to show respective current row year from Time table.
Please suggest.
Thank you.