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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
jr3151006
Helper IV
Helper IV

How to show slicer value (filtered date [sometimes multiple]) in a card

Hi,

 

I have a parameters page where the user select on a slicer, the YEAR and MONTH to filter data; sometimes that selection can handle more than one month for the same year or event different months on different years.

 

>>> Is there a DAX for catch the filtered date interval and then show it on a CARD on the HOME-PAGE?

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Ideally you should be working with a calendar table. Even if you aren't, include a field for "Month-Year" using the following code:

Month - Year = FORMAT([Date], "MMM") & "-" & YEAR([Date])) ​ 

 field.png

Next create a measure along the lines of:

Selected Periods =
IF (
ISFILTERED ( 'Calendar Table' ),
CONCATENATEX (
VALUES ( 'Calendar Table'[Month - Year] ),
'Calendar Table'[Month - Year],
", "
),
"No Period Selected"
)

 

To get...

periods.gif

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

7 REPLIES 7
jr3151006
Helper IV
Helper IV

😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲😲

 

Hi @PaulDBrown,


tks for quick-reply, it seems exactly I need.

I´ll test in a few hours here in a LAB environment and also on the production and then ping back here. 

PaulDBrown
Community Champion
Community Champion

Ideally you should be working with a calendar table. Even if you aren't, include a field for "Month-Year" using the following code:

Month - Year = FORMAT([Date], "MMM") & "-" & YEAR([Date])) ​ 

 field.png

Next create a measure along the lines of:

Selected Periods =
IF (
ISFILTERED ( 'Calendar Table' ),
CONCATENATEX (
VALUES ( 'Calendar Table'[Month - Year] ),
'Calendar Table'[Month - Year],
", "
),
"No Period Selected"
)

 

To get...

periods.gif

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi,

I need help,

I have a situation here where I need to show multiple values selected from multiple sicers in a card visual.

multiple values of same slicer should be seperated by ","and multiple values from multiple slicers should be seperated by "|".

for example, if i select INDIA and USA from country slicer, result is  INDIA,USA 

if i select INDIA and USA from country slicer and  2021,2022 from year slicer ,result is INDIA,USA |2021,2022

if no values selected from any slicer, result is "Not selected".

 

thanks in advance...

Try:

 

 

Selection =
VAR _Country =
    IF (
        ISFILTERED ( 'Country Slicer'[Country] ),
        CONCATENATEX (
            VALUES ( 'Country Slicer'[Country] ),
            'Country Slicer'[Country],
            ", "
        )
    )
VAR _Year =
    IF (
        ISFILTERED ( 'Year Slicer'[Year] ),
        CONCATENATEX ( VALUES ( 'Year Slicer'[Year] ), 'Year Slicer'[Year], ", " )
    )
RETURN
    _Country & " | " & _Year

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi Paul, 

Thank you so much for the quickest response, here when I select multiple values from single slicer, it's showing pipe symbol,it just need to show only the values selected seperated by comma, it should not display the pipe symbol as there is no selection from other slicer and when no slicer values selected, it should display "Not Selected"

IMG_20221020_145150.jpg

In that case, try:

Selection =
VAR _Country =
    IF (
        ISFILTERED ( 'Country slicer'[Country] ),
        "Countries: "
            & CONCATENATEX (
                VALUES ( 'Country slicer'[Country] ),
                'Country slicer'[Country],
                ", "
            ),
        "No countries selected"
    )
VAR _Year =
    IF (
        ISFILTERED ( 'Year Slicer'[Year] ),
        CONCATENATEX ( VALUES ( 'Year Slicer'[Year] ), 'Year Slicer'[Year], ", " ),
        "No years selected"
    )
RETURN
    _Country & " | " & _Year




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi  Paul,

Thank you for the response ,means a lot.

I couldn't convey to you properly what I need to show on the card, please look into the below scenarios.

I have 3 slicers here, Year,LocID,CourseID 

for example, if I select 2017 and 2018 from Year slicer,

The result should be : 2017,2018   (here "|" is not expecting after the result)

if I select "HYD" and "BZA"  from LocID slicer and  2021,2022 from year slicer and "Azure-C","Azure-F" from CourseID,

result is: HYD,BZA | 2021,2022 |Azure-C,Azure-F

If I select no values from three slicers,

Result is: Not Selected (only when all three are not selected)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.