Forum Discussion
Sum using slicer
- 2 years ago
Anonymous
I modified the year to accommodate 2024:Sales Compared Year = VAR __CurrentYear = SELECTEDVALUE( Table22[Year]) VAR __Year = SWITCH( __CurrentYear, 2022 , 2023, 2023, 2022, 2024 , 2023 ) VAR __Months = VALUES( Table22[Month] ) VAR __Result = CALCULATE( [Selected Year Sales], Table22[Year] = __Year, __Months ) RETURN
Anonymous
In that case, how you would you decide which is the current year and which is the compared year. Say, in the lislicer, you pick 2023 and which year will be considered for comparison, 2022 or 2024? what is the logic?
Hi Fowmy ,
Thanks for the response.
With 3 years of data(2022,2023,2024),
When we select 2022 in the slicer : 2022 will be the current year and 2023 will be compared year.
When we select 2023 in the slicer: 2023 will be current year and 2022 will be compared year(As we don't have full year of 2024 data so we will be comparing it with 2022 only.).
When we select 2024 in slicer: 2024 will be current year and 2023 will be compared year.
Thanks in advance.
- Fowmy2 years agoSuper User
Anonymous
I modified the year to accommodate 2024:Sales Compared Year = VAR __CurrentYear = SELECTEDVALUE( Table22[Year]) VAR __Year = SWITCH( __CurrentYear, 2022 , 2023, 2023, 2022, 2024 , 2023 ) VAR __Months = VALUES( Table22[Month] ) VAR __Result = CALCULATE( [Selected Year Sales], Table22[Year] = __Year, __Months ) RETURN- Anonymous2 years agoNot applicable
I am getting belwo error while using above created measure in the calculation:
what should i do?