Forum Discussion
Repeat sample year data upto 2050
- 3 years ago
You can create the data table with fake datestamps directly from your existing data table with
Fake Data Table = VAR StartDate = CALCULATE ( MINX ( DATESINPERIOD ( 'Date'[Date], TODAY (), -1, YEAR ), 'Date'[Date] ) ) RETURN CALCULATETABLE ( ADDCOLUMNS ( 'Data Table', "Fake Datestamp", DATE ( 1900, MONTH ( 'Data Table'[Datestamp] ), DAY ( 'Data Table'[Datestamp] ) ) + TIME ( HOUR ( 'Data Table'[Datestamp] ), MINUTE ( 'Data Table'[Datestamp] ), 0 ) ), 'Data Table'[Datestamp] >= StartDate && 'Data Table'[Datestamp] < TODAY () )
however this works for Fake timestamp = if(year(KalenderX[Date]) <> 1900,DATE(1900,MONTH(KalenderX[Date]),DAY(KalenderX[Date])))
An argument to the 'DATE' function has the wrong data type, or the result is too large or too small.Is what I get when i add baseCalendar
- johnt753 years ago
Super User
You can create the data table with fake datestamps directly from your existing data table with
Fake Data Table = VAR StartDate = CALCULATE ( MINX ( DATESINPERIOD ( 'Date'[Date], TODAY (), -1, YEAR ), 'Date'[Date] ) ) RETURN CALCULATETABLE ( ADDCOLUMNS ( 'Data Table', "Fake Datestamp", DATE ( 1900, MONTH ( 'Data Table'[Datestamp] ), DAY ( 'Data Table'[Datestamp] ) ) + TIME ( HOUR ( 'Data Table'[Datestamp] ), MINUTE ( 'Data Table'[Datestamp] ), 0 ) ), 'Data Table'[Datestamp] >= StartDate && 'Data Table'[Datestamp] < TODAY () )- Asina3 years ago
Helper III
Thank you for reply.
However, what is the "'Date'[Date]", what table is that?
I assume the Data Table is where my data is, which contains data from 1-1-2021 till today?
- johnt753 years ago
Super User
Yes, the Data Table is where you have data from 2021 to date.
The 'Date' table is your model's date or calendar table. It should have 1 entry for each day for each year you wish to show data for and it should be marked as a date table in Power BI. Almost every model should have one