Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
4 years ago

Filter calendar table

Good

Currently, we use a calendar table containing years from 1999 to 2100. We have detected that this generates problems when filtering a year, since they come out of the table every year.

I am proposing ways to filter the calendar table, but I would not be able to say which is the most correct and if there would be any better option.

I have contemplated the following cases:

  • Case 1: There is only one table of facts:
    • Make the filtering of the relationship between the two tables bidirectional.
    • From query editor get the first and last dates from the fact table and filter the calendar table by those dates. The latter would not know how to do it, but I think it could, any idea?
  • Case 2: There are several tables of facts in the model:
    • We cannot put relationships with bidirectional filter in this case.
    • Get the maximum and minimum date of all the fact tables in the model, then get the maximum and minimum date of the previous ones, and finally filter the calendar table by those dates. I have to investigate if it can be done. Any ideas?

Could you help me? I think there has to be a simpler and more optimal way to do that.

1 Reply