Forum Discussion

AllanBerces's avatar
AllanBerces
Icon for Post Prodigy rankPost Prodigy
1 year ago
Solved

Dynamic Date pass 2 weeks and advance 2 weeks

Hi good day can anyone help me on how can i make my date on my column chart be dynamic from pass 2 weeks and advance two weeks (for lookahead plan). I have two table Plan and Actual and both are connected to my calendar table, something like this

Thank you

  • Add a column to your calendar table which you can then use as a filter on the column chart.

    You could create the column in SQL, Power Query or DAX. Sample DAX might be

    Within 4 week window =
    'Calendar'[Date]
        >= TODAY () - 14
        && 'Calendar'[Date]
            <= TODAY () + 14
    

    You can make the logic as simple or complex as you need to, perhaps working with week starting and ending dates.

    Add the new column as a filter on your chart to only show when the column is true.

4 Replies

  • Add a column to your calendar table which you can then use as a filter on the column chart.

    You could create the column in SQL, Power Query or DAX. Sample DAX might be

    Within 4 week window =
    'Calendar'[Date]
        >= TODAY () - 14
        && 'Calendar'[Date]
            <= TODAY () + 14
    

    You can make the logic as simple or complex as you need to, perhaps working with week starting and ending dates.

    Add the new column as a filter on your chart to only show when the column is true.

    • AllanBerces's avatar
      AllanBerces
      Icon for Post Prodigy rankPost Prodigy

      Hi johnt75 thank you for the reply, but when I try the DAX its show all True on my calendar table, even 2023

      • johnt75's avatar
        johnt75
        Icon for Super User rankSuper User

        I made a silly mistake, it was an or condition not an and condition. I've edited my original post to use && instead of ||.