Forum Discussion
Anonymous
4 years agoNot applicable
Display Current Selected year vs Previous year
I have data similar to the one below I would like to use a year slicer to control a stacked Column chart. I have one stream that has data from 2020 - 2022 with scores for two subjects Maths & Engl...
- 4 years ago
Hi, Anonymous
Try steps as below:
1.create/enter a seperate table 'Slicer' as below:
Slicer = VALUES('Date'[Year])2. add a measure as below and apply it to visual filter pane
filter control = VAR a = IF ( MAX ( 'Date'[Year] ) = MAX ( Slicer[Year] ) || MAX ( 'Date'[Year] ) = MAX ( Slicer[Year] ) - 1, 1, 0 ) RETURN IF ( ISFILTERED ( Slicer[Year] ), a, 1 )Best Regards,
Community Support Team _ Eason
Anonymous
4 years agoNot applicable
amitchandak the above didn't work.
Could the summarize function help with this?
Something like
Selected Year Score =
SWITCH( SELECTEDVALUE(Date[Year]),
"2021",SUMMARIZE(
'Data',Data[DateMonth],
"Score2021", Calculate(SUM('Data'[Score]),Filter('Data','Data'[StreamYear] = "A2021")),
"Score2020",Calculate(SUM('Data'[Score]),Filter('Data','Data'[StreamYear] = "A2020"))))
Though I'm getting an error"The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value"
Would this work?
'Data',Data[DateMonth],
"Score2021", Calculate(SUM('Data'[Score]),Filter('Data','Data'[StreamYear] = "A2021")),
"Score2020",Calculate(SUM('Data'[Score]),Filter('Data','Data'[StreamYear] = "A2020"))))
Though I'm getting an error"The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value"
Would this work?
v-easonf-msft
Community Support
4 years agoHi, Anonymous
Try steps as below:
1.create/enter a seperate table 'Slicer' as below:
Slicer = VALUES('Date'[Year])
2. add a measure as below and apply it to visual filter pane
filter control =
VAR a =
IF (
MAX ( 'Date'[Year] ) = MAX ( Slicer[Year] )
|| MAX ( 'Date'[Year] )
= MAX ( Slicer[Year] ) - 1,
1,
0
)
RETURN
IF ( ISFILTERED ( Slicer[Year] ), a, 1 )
Best Regards,
Community Support Team _ Eason