Forum Discussion

mshamsiev1234's avatar
mshamsiev1234
Regular Visitor
1 year ago
Solved

Month Filter Displayed As Text

Hey community!

 

I am looking to create a text box or card based visual that displays all selected filters for our end users. I have managed to do so with the standard filters (though it only seems to work for one selection). However, is there a way I can do the same for a date range filter? I create a measure as per the below:

Measure = CONCATENATEX(VALUES('Calendar'[Month name]),'Calendar'[Month name],",")

 

But this results in the below display:

 

Is it possible to show it in the following format:  Jul-24 > Oct-24? 


Cheers,

Mike

 

  • Hi mshamsiev1234 

    why not get the min and max months selected instead?

    MinMaxMonths = 
    VAR MinMonth = FORMAT(MIN('Calendar'[Month]), "mmm-yy")
    VAR MaxMonth = FORMAT(MAX('Calendar'[Month]), "mmm-yy")
    RETURN MinMonth & ">" & MaxMonth
    

     

6 Replies

  • Hi mshamsiev1234 -  Use the MIN and MAX functions to identify the range of selected dates in the slicer and format them appropriately.

     

    SelectedDateRange =
    VAR MinDate = MIN('Calendar'[Date])
    VAR MaxDate = MAX('Calendar'[Date])
    RETURN
    IF (
    ISBLANK(MinDate) || ISBLANK(MaxDate),
    "No Dates Selected",
    FORMAT(MinDate, "MMM-yy") & " > " & FORMAT(MaxDate, "MMM-yy")
    )

     

     

    It works, please check and confirm

  • Hi mshamsiev1234 

    why not get the min and max months selected instead?

    MinMaxMonths = 
    VAR MinMonth = FORMAT(MIN('Calendar'[Month]), "mmm-yy")
    VAR MaxMonth = FORMAT(MAX('Calendar'[Month]), "mmm-yy")
    RETURN MinMonth & ">" & MaxMonth
    

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi mshamsiev1234 ,

     

    Thank you for reaching out to our community.

    I see that rajendraongole1 and danextian have provided great solutions. Did their replies help you?

    If so, please accept the reply as a solution. This will make it easier for the future people to find the answer quickly.

    If not, please provide a more detailed description, preferably some virtual sample data, and the expected results.

     

    Best Regards,

    Stephen Tao

     

    • mshamsiev1234's avatar
      mshamsiev1234
      Regular Visitor

      Hey Stephen thanks for the message 🙂 All great solutions. In this case, I have used danextians solution which worked a treat. Thanks again to everyone here, much appreciated!

  • Thank you all for the incredible help! Always learn something new from the community 🙂