Forum Discussion

pfarahani's avatar
pfarahani
Helper II
4 years ago

DAX Dynamic Filter

Hello All,

 

I have code used for dynamic filter. When the user choose a Year from the Year slicer it will display the chosen years in the visual. But I am trying to add a filter to this code (I dont know where to add it). 

I want to add a filter, something like this: 

FILTER('_JBSIS Probate Dates Year Month','_JBSIS Probate Dates Year Month'[DisplayYear]="1")

 

 

5 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    pfarahani  Sorry but I don't know where to add it either with only the info you've provided. What does 'Display Year' mean? What info is in that column? Why does this filter need added to a measure that is designed to show which filters are already applied? 

     

    If you can provide more detail, we can be more helpful. 

    • pfarahani's avatar
      pfarahani
      Helper II

      Hi Allison,

       

      Here is the thing, maybe I do not need Display Year=1. I just want the filter so that I can cap the year at a certain point. My years only goes up to 2021 in my model. It would be nice to do it dynamcally (use MAX year from my model). Display Year is an IF expression I wrote, its a calculated column, it displays 1 or 0 depending if I have a data for that year. It would be great if I could add a Filter, MAX year from the table I have that contains data, which goes up to 2021 for now, more years will be added later. 

      • AllisonKennedy's avatar
        AllisonKennedy
        Community Champion

        pfarahani Is _JBSIS Probate Dates Year Month a DimDate table containing dates beyond those that actually have data? 

         

        You could simply add a filter to the page or even filters on all pages sections or to a specific visual (depending on what you want), that says Display Year = 1

         

         

        And that will ensure only valid dates are selectable. 

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi pfarahani ,

     

    I have built a data sample, but actually I'm not very clear about your expected output.

     

    If you want to filter out DisplayYear<> "Include" as shown below:

     

    you may try:

    If it does not help you , please describe what you expected in detail to help us clarify your scenario.

     

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.