Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Year and Month Current Selections

ShowSlicerContents = 

IF (

    ISFILTERED ( AXA_Date[Date].[Year]) & ISFILTERED(AXA_Date[Month] ),

    "Year:" & UNICHAR ( 10 )

        & CONCATENATEX ( DISTINCT (  AXA_Date[Date].[Year]),  AXA_Date[Date].[Year], ", " )

     "Month:" & UNICHAR ( 10 )                                                                                         & CONCATENATEX ( DISTINCT (  AXA_Date[Date].[Month]),  AXA_Date[Date].[Month], ", " ),

          "No filter applied"

)


I am trying to create a current selections box.

I can bring Year on its own and Month on its own but trying to bring them out together in a Card.

Anyone see my measure  issue above?

7 REPLIES 7
Mariusz
Community Champion
Community Champion

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

Anonymous
Not 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

Hi @Anonymous 

Can you send your code?

 

Thanks

Mariusz

Anonymous
Not 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"
)

Hi @Anonymous 

The measure should return "All Selected" when there is no filters applied, the only way it will return Year value is if the Year column is filtered.

 

Are you sure you have no filters applied on the report Page? 

Thanks
Mariusz

Anonymous
Not applicable

Ahhhh, that was it.

I had a filter on.

Thank you.

Works perfect.

Hi @Anonymous 

Can you mark the original answer as solution please.

 

Many Thanks
Mariusz

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors