Forum Discussion

Gladiator909's avatar
Gladiator909
Icon for Helper I rankHelper I
4 years ago
Solved

Visual Level Filter not working on Date Hierarchy

Hi there,

 

I have been stuck on this for a few hours now and I can't seem to get it to work.

 

I have a date that has values ranging from January 1st 2015 to December 31st 2025.

 

In my drop down slicer, I have used Date Hierarchy from my date table and only selected "Year". See picture below:

 

 

 

Now I would like the drop down slicer to only display the current year that I am in (2022) but it needs to do it dynamically, that is, when we reach January 1st 2023, it should automatically display 2023.

 

To achieve that, I used the date field and set "Filters on this Visual" as Relative Date is in this Year (see pic below)

However, as you can see from the picture, it didnt filter any of the Years.

 

Anyone knows why? and how we can get around this issue?

 

Thanks

 

 

  • Hi,

    I tested it and that happened to me too.

    So, I created the Column measure for showing the current year (Yes/No) :

    IsCurrentYear = if (year('Date'[Date]) = year(TODAY()), "Yes", "No")
    Then developed the Slicer on Date column (year) and put the "IsCurrentYear' in the Filter pane and unchecked the 'No' Values :

     

    Thanks for Kudos

4 Replies

  • vanessafvg's avatar
    vanessafvg
    Icon for Community Champion rankCommunity Champion

    that does seem  very odd, assuming the date is from the same table?  also assuming the year which has been calculated is correct?

    • Gladiator909's avatar
      Gladiator909
      Icon for Helper I rankHelper I

      Yea everything is from the same table.

       

      I didn't calculate the year, the date column in the table automatically provided me with the "Hierarchy", I did not have to calculate anything.

      • vanessafvg's avatar
        vanessafvg
        Icon for Community Champion rankCommunity Champion

        I tested it and there is no reason why it should not work, are you able to share your model or a sample? 

  • MahyarTF's avatar
    MahyarTF
    Icon for Memorable Member rankMemorable Member

    Hi,

    I tested it and that happened to me too.

    So, I created the Column measure for showing the current year (Yes/No) :

    IsCurrentYear = if (year('Date'[Date]) = year(TODAY()), "Yes", "No")
    Then developed the Slicer on Date column (year) and put the "IsCurrentYear' in the Filter pane and unchecked the 'No' Values :

     

    Thanks for Kudos