Forum Discussion
Create formula switch measure depending on year selected
IF( values('table1'[Year]) = year(today()) && MONTH(today()) > 5, [Salestable1], [Salestable2])
This will give SalesTable1 for october 2023.
Use an isfiltered function for [year], also specify what is the required value when two years are selected.
hello
Thanks for your reply.
Let say we are in onctober 2023 and that 2021,2022,2023 are selected The required values are Salestable1 in the column 2023 and Salestable2 in the column 2021 and 2022.
(If we are in March 2023 in all the 3 columns I have to have Salestable2 )
Can you suggest me a formula?
Thanks
- ChiragGarg25122 years ago
Solution Sage
Anne14 , This measure should work but introduce a date column somehow, because for multiple selection on slicer there needs to be a distinction. If the table visual just has productName and measure, then multiple selection is going to create a problem. In matrix visual, set rows as product, columns as year and values as measures.
- Anne142 years agoFrequent Visitor
that is what I did : try the matrix visual but I have the error that columns contain multiples where 1 was expected when I select 2 or more years in the slicer 😞 I think the IF function will always require one selected value.. I need some other solution
thanks
- ChiragGarg25122 years ago
Solution Sage
if year is part of column fields, there would be no need of slicer. If slicer is needed, make a field parameter.