Forum Discussion

afk's avatar
afk
Advocate II
8 years ago

Dynamic date charts (for week number)

Hi,

 

How do I create a chart that only shows data for the past 6 weeks for example? I have a weeknum column and I've put this column on the x-axis of the charts.

 

At the moment, the chart shows all week numbers that exist in the data and will continue to build when more data is inputted. So over time this will get cramped hence why i only want to show the past 6 weeks.

 

Thanks!

5 Replies

  • jthomson's avatar
    jthomson
    Solution Sage

    If your week number is being derived off some sort of date field, what you can do is put the date field in the visual filter section and use the relative date filtering to say you're only wanting data within the last 42 days. Not sure how it would work if it isn't, perhaps make some sort of calculated column that has a week number running continuously (so that it doesn't reset year on year), then look up the largest value (to get the current week number), and do some DAX to take that off of your new column, add six, then filter on positive values?

    • afk's avatar
      afk
      Advocate II

      Hi jthomson,

       

      Thanks for your suggestion. Yes, my week number is derived from a date field so this suggestion works easily. However, this only works well if the data is constantly up to date.

       

      Currently, my data is only dated up to mid Jan. Is there a way for the charts to show the latest 6 weeks from the latest date in the data? 'MAX(date) - 6 weeks' for example.