Forum Discussion
Year and Month Current Selections
Hi Anonymous,
Please see the below and do let me know if its what you need.
Year Month Selected Slicer Values =
VAR y = ISFILTERED('Calendar'[Year])
VAR m = ISFILTERED('Calendar'[Month])
RETURN
SWITCH(
TRUE(),
y && m, CONCATENATEX(
SELECTCOLUMNS(
SUMMARIZE(
'Calendar',
'Calendar'[Year],
'Calendar'[Month]
),
"str", 'Calendar'[Year] & "-" & 'Calendar'[Month]
),
[str], "; "
),
y, CONCATENATEX(
VALUES('Calendar'[Year]),
'Calendar'[Year], "; "
),
m, CONCATENATEX(
VALUES('Calendar'[Month]),
'Calendar'[Month], "; "
),
"All Selected"
)If you have concatinated Year month field please replace the Concat in the code.
Hope this helps
Mariusz
- Anonymous7 years agoNot applicable
Thank you. It now works but the only thing is when nothing is selected, i get all years back
2017 2018 2019
when it should be blank
- Mariusz7 years ago
Community Champion
Hi Anonymous
Can you send your code?
Thanks
Mariusz
- Anonymous7 years agoNot applicable
I am having the same issue with a Service, Owner and Assignment group also
Code Below:
It doesnt do the same for Owner or assignment group. It seems to only throw back all the results of Service.
Year is doing the same thing.
I assume it should be blank like Owner and Service are.
The same applies to Year & Month. Year returns everything when nothing is selected but they do work however as they should do when i do, select something,
MappingFilter = VAR S = ISFILTERED('Mapping'[Service]) VAR O = ISFILTERED('Mapping'[Owner]) VAR G = ISFILTERED('Mapping'[Assignment group]) RETURN SWITCH( TRUE(), S && O && G, CONCATENATEX ( SELECTCOLUMNS( SUMMARIZE( 'Mapping', 'Mapping'[Service], 'Mapping'[Owner], 'Mapping'[Assignment group] ), "str", 'Mapping'[Service] & "-" & 'Mapping'[Owner] & "-" & 'Mapping'[Assignment group] ), "Filter: " & [str], "; " ), S, CONCATENATEX( VALUES('Mapping'[Service]), 'Mapping'[Service], "; " ), O, CONCATENATEX( VALUES('Mapping'[Owner]), 'Mapping'[Owner], "; " ), G, CONCATENATEX( VALUES('Mapping'[Assignment group]), 'Mapping'[Assignment group], "; " ), "All Selected" )