Forum Discussion

Stuznet's avatar
Stuznet
Helper V
7 years ago
Solved

Filter Year Dynamically without Slicer

Hi guys,

 

I'm having problem filtering the year dynamically without using my slicer. 

I'm summing the total of IDs for this year. I could add the year in the page filter but I don't want to keep toggling the year after another.

I would like the year change that reflect to the current year. This is the function I wrote but I'm not getting the correct value.

Measure = CALCULATE([Measure]),FILTER(Table1,Table1[YearNumber] >= YEAR(Now())))

Can someone please help? thanks

  • Many times, this is handled in the data or a measure via something along the lines of (column form):

     

    Column = IF(YEAR(TODAY())=YEAR([Date]),1,0)

    Then you just filter on 1

  • Stuznet's avatar
    Stuznet
    7 years ago

    Greg_DecklerThank you :) I was able to get the correct count.

     

    This is what I did

    1) Create new column

     

    Column = IF(YEAR(TODAY()) = YEAR([columnDate]),1,0)

     

    2) Create new measure

     

    Measure = CALCULATE(SUM(Table1[measure]),FILTER(Table1,Table1[Column]))

     

     

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Many times, this is handled in the data or a measure via something along the lines of (column form):

     

    Column = IF(YEAR(TODAY())=YEAR([Date]),1,0)

    Then you just filter on 1

    • Stuznet's avatar
      Stuznet
      Helper V

      Greg_DecklerThank you :) I was able to get the correct count.

       

      This is what I did

      1) Create new column

       

      Column = IF(YEAR(TODAY()) = YEAR([columnDate]),1,0)

       

      2) Create new measure

       

      Measure = CALCULATE(SUM(Table1[measure]),FILTER(Table1,Table1[Column]))