Jump to content

How to know the date range from a week number

Dario Dicao

Recommended Posts


I would like to know if it is possible to display on the X-axis of a line chart the period of dates referring to a number of weeks.

My X-axis is configured to show the week of a datetime field, so it is showing the number (ex. 20). I would like it to show something like "9-15April".



Link to comment
Share on other sites

You could create a reference table from where you can join this information. But you have to write a data function to achieve this.

This data function has to know the min and max date of your data table. This infocan be hardcoded, a user input (doc property) or you use a function that creates those values for you from the week and year information of your original table.

With the min and max date you can now create a data table that has one column with the sequence of dates. Then calculate two more columns with year and week information. And finally aggregate your table by year week to get minimun and maximum of the date column as start and end date of the week.

Now, you have a full data set with year, week, week.start, week.end. With the latter two columns you can do the final calculation to get the desired string. Then output this table and merge the desired column to your data and use it on your x axis.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...