Forum Discussion
Dynamic Table Visual - Same date last Year
- 1 year ago
Hi Ibrahim_shaik
Have a last year column in the Main Table using the Date column that you have:
LY Date= DATEADD('MainTable'[Date], -1, YEAR)
We can achieve the previous year value using LOOKUP:Temperature_LY = LOOKUPVALUE( 'MainTable'[Temperature], 'MainTable'[Date], 'MainTable'[LastYearDate], 'MainTable'[Time], 'MainTable'[Time] )Do the same for Humidity and since Power is from another table:
Power_LY = LOOKUPVALUE( 'PowerTable'[Power], 'PowerTable'[Date], 'MainTable'[LastYearDate], 'PowerTable'[Time], 'MainTable'[Time] )
Hi Ibrahim_shaik
This could be used to get the last year: LastYearDate = DATEADD('Date'[Date], -1, YEAR)
and if you actually want to calculate the measures for last year as well. Something like this would suffice:
Temperature LY =
VAR LDate = DATEADD('Date'[Date], -1, YEAR)
RETURN
CALCULATE(
AVERAGE('MainTable'[Temperature]),
FILTER(
ALL('MainTable'),
'MainTable'[Date] = LDate &&
'MainTable'[Time] = SELECTEDVALUE('MainTable'[Time])
)
)
Please provide more context if this is not what you are looking for.