Forum Discussion
Formatting Year and Calendar Week
- Anonymous7 years ago
Hi,
have you a Year dimension table? Or have you just one large table?
If you have a table Calendar with the list of Year, you can create these measures:
TotalValue = SUM(Value)
TotalValue PY = CALCULATE([TotalValue], FILTER( ALL(Calendar), Calendar[Year] = MAX(Calendar[Year])-1))
Total Value YoY = TotalValue - TotalValue PY
% vs TotalVaue PY = DIVIDE(Total Value YoY, TotalValue PY)
I believe my problem description was not well described from my side.
When I build graphs within Powerbi, I want to calculate the sales change in % between 2019 and 2018.
Under quick measures I can select the calculation " change in comparison to previous year". Aftwerwards, I need to select the data field, based on which the previous year calculation should be made.
The problem starts after this point. I cannot select the column "Year" as a basis for the previous year calculation. It is not accepted as a date format. Since I have only the year and not the day, I could not find a way to solve this issue.
Thanks for your time
Hi,
have you a Year dimension table? Or have you just one large table?
If you have a table Calendar with the list of Year, you can create these measures:
TotalValue = SUM(Value)
TotalValue PY = CALCULATE([TotalValue], FILTER( ALL(Calendar), Calendar[Year] = MAX(Calendar[Year])-1))
Total Value YoY = TotalValue - TotalValue PY
% vs TotalVaue PY = DIVIDE(Total Value YoY, TotalValue PY)