Forum Discussion
How to combine 2 expression into 1 ?
- 4 years ago
That's because it needs to be defined as a new calculated table, not a measure or calculated column. See the example I attached previously.
You aren't going to be able to do that with a calculated column since each year can only belong to at most one of 3 or 4.
You can approach this in a different way though and create a new parameter table to use for the slicer and then define a measure to use as a filter on your date slicer.
For the option to select 1-5 years back, define a new calculated table like this:
ShowLast = SELECTCOLUMNS ( GENERATESERIES(1, 5), "Year", [Value] )
Then you can define a measure like this which you'll then set as a visual filter for the date table year slicer:
YearFilter =
VAR SelectedYear = SELECTEDVALUE ( ShowLast[Year], MAX ('Date'[Year] ) )
VAR CalendarYear = MAX ( 'Date'[Year] )
RETURN
IF ( YEAR ( TODAY() ) - CalendarYear <= SelectedYear, 1, 0 )
See the attached file.
Thank you for your help , i get below error :-
A table of multiple values was supplied where a single value was expected.
https://www.dropbox.com/s/ax5w2w8ygxzzw8h/PBS_VER0351.pbix?dl=0
Above link is my PBI
Paul
- AlexisOlson4 years ago
Super User
That's because it needs to be defined as a new calculated table, not a measure or calculated column. See the example I attached previously.
- admin114 years ago
Memorable Member
many thank