Forum Discussion

ILAN102010SH's avatar
ILAN102010SH
Frequent Visitor
9 years ago
Solved

Creating historical table of dates

Hello, I have one table with columns ( user id, start date, end date)
Is it possible to make a new calender table that in it,
Will be the user id exactly in the range of dates between start date and end date?
How can I do it?
Your help will be very appreciated!
Best Regards,
Ilan-S
  • Hi ILAN102010SH

     

    You could try the following calculated table.  In my case I have a table called 'Table4' with UserID, Start Date and End Date

     

    My New Table = SELECTCOLUMNS(
                        FILTER(
    			         CROSSJOIN(CALENDARAUTO() , 'Table4') ,
    				        [Date] >= 'Table4'[Start Date]
    				    && [Date] <= 'Table4'[End Date]
    		          ),
                      "UserID" ,'Table4'[UserID] ,
                      "Date" , [Date]
                    )

7 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi ILAN102010SH

     

    You could try the following calculated table.  In my case I have a table called 'Table4' with UserID, Start Date and End Date

     

    My New Table = SELECTCOLUMNS(
                        FILTER(
    			         CROSSJOIN(CALENDARAUTO() , 'Table4') ,
    				        [Date] >= 'Table4'[Start Date]
    				    && [Date] <= 'Table4'[End Date]
    		          ),
                      "UserID" ,'Table4'[UserID] ,
                      "Date" , [Date]
                    )
  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    You can create a new table with the formula:

     

    Table = CALENDARAUTO()

    This creates a date table that autogenerates from the dates in your data model. Thus, if you created a data model with a single row from your table, you might get lucky.