Forum Discussion

akwang's avatar
akwang
Icon for Advocate II rankAdvocate II
9 years ago
Solved

MAX & MIN Dates from Multiple tables

Hi I have a model with a calendar Table and 3 other Record tables all with different dates. To Create the Calendar Table i used this:   DateTable = ADDCOLUMNS ( CALENDAR (MINX(Table1,[Date ]), M...
  • Anonymous's avatar
    Anonymous
    9 years ago

    The range of dates is calculated automatically based on data in the model by using CALENDARAUTO().

    Try this....

     

    DateTable = 

    ADDCOLUMNS (
    CALENDARAUTO(),
    "Year", YEAR ( [Date] ),
    "QuarterOfYear", "Q" & FORMAT ( [Date], "Q" ),
    "MonthOfYear", FORMAT ( [Date], "MM" ),
    "MonthInCalendar", FORMAT ( [Date], "mmm YYYY" ),
    "QuarterInCalendar", "Q" & FORMAT ( [Date], "Q" ) & " " & FORMAT ( [Date], "YYYY" ),
    "DayInWeek", WEEKDAY ( [Date] ),
    "DayOfWeekName", FORMAT ( [Date], "dddd" ),
    "DayOfWeekShort", FORMAT ( [Date], "ddd" ),
    "MonthNameShort", FORMAT ( [Date], "mmm" ),
    "RelativeYear", (YEAR(NOW())- YEAR ( [Date] )))