Forum Discussion
SGBaringa
2 years agoFrequent Visitor
Previous year value based on year integer slicer
Hello PBI Community, I am having a hard time trying to figure out a solution for a seemilngly simple case. What I have are two tables, Calendar and Sales. Calendar contains only one column wh...
- 2 years ago
Hi SGBaringa - you are getting that issue because of the filter context applied on slicer calender entity.
can you check the below formaule:
PreviousYearRevenue =
VAR SelectedYear = SELECTEDVALUE('Calendar'[Year])
VAR PreviousYear = SelectedYear - 1
RETURN
CALCULATE(
SUM('Sales'[Revenue]),
'Sales'[Period] = PreviousYear,
ALL('Calendar')
)It works.
rajendraongole1
2 years agoSuper User
Hi SGBaringa - you are getting that issue because of the filter context applied on slicer calender entity.
can you check the below formaule:
PreviousYearRevenue =
VAR SelectedYear = SELECTEDVALUE('Calendar'[Year])
VAR PreviousYear = SelectedYear - 1
RETURN
CALCULATE(
SUM('Sales'[Revenue]),
'Sales'[Period] = PreviousYear,
ALL('Calendar')
)
It works.
- SGBaringa2 years agoFrequent Visitor
This worked! Thank you so much rajendraongole1 !