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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
vimina
Frequent Visitor

Display Text based on date slicer selection

I have two slicers : Year and Period. Year is a single selector slicer and Period is multiselector. A Text needs to be displayed in a card based on the slicer selection.
If an year is selected and all the period of that year are selcted then display "Selected Year is '2022' " ELSE
if any period is selected for eg 1, 3,5 then display "Selected Range is for "Year" and Period 1,3,5"

vimina_0-1682772285807.png

pbix file: https://drive.google.com/file/d/1owzvBBV1ALzdNukg5pgjUaPApTgYDPaD/view?usp=sharing

1 ACCEPTED SOLUTION
vimina
Frequent Visitor

I have tweaked the below measure, if anybody is looking for the similar requirement then this measure can be used:

Modified Card Value =
IF(ISFILTERED('Date'[Year]) && ISFILTERED('Date'[Period]),
    "Selected Year is : " & FORMAT(SELECTEDVALUE('Date'[Year]), "0") & " And " &
    IF(DISTINCTCOUNT('Date'[Period]) = 1,
        "Selected Range is for Period: " & MIN('Date'[Period]),
        IF(MAX('Date'[Period]) - MIN('Date'[Period]) + 1 = DISTINCTCOUNT('Date'[Period]),
            "Selected Range is for Period: " & MIN('Date'[Period]) & " - " & MAX('Date'[Period]),
            "Selected Range is for Periods: " & CONCATENATEX(VALUES('Date'[Period]), 'Date'[Period], ", "))),
    "Selected Year is : " & FORMAT(SELECTEDVALUE('Date'[Year]), "0")

View solution in original post

2 REPLIES 2
vimina
Frequent Visitor

I have tweaked the below measure, if anybody is looking for the similar requirement then this measure can be used:

Modified Card Value =
IF(ISFILTERED('Date'[Year]) && ISFILTERED('Date'[Period]),
    "Selected Year is : " & FORMAT(SELECTEDVALUE('Date'[Year]), "0") & " And " &
    IF(DISTINCTCOUNT('Date'[Period]) = 1,
        "Selected Range is for Period: " & MIN('Date'[Period]),
        IF(MAX('Date'[Period]) - MIN('Date'[Period]) + 1 = DISTINCTCOUNT('Date'[Period]),
            "Selected Range is for Period: " & MIN('Date'[Period]) & " - " & MAX('Date'[Period]),
            "Selected Range is for Periods: " & CONCATENATEX(VALUES('Date'[Period]), 'Date'[Period], ", "))),
    "Selected Year is : " & FORMAT(SELECTEDVALUE('Date'[Year]), "0")
Ahmedx
Super User
Super User

pls try this

Card_Value = 
IF( ISFILTERED('Date'[Year])&&ISFILTERED('Date'[Period]),
        "Selected Year is : " & FORMAT(SELECTEDVALUE('Date'[Year]), "0") &" And  "&"Selected Range is for Period: " & MIN('Date'[Period]) & " - " & MAX('Date'[Period]),
        "Selected Year is : " & FORMAT(SELECTEDVALUE('Date'[Year]), "0")
)

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.