Skip to main content

Posts

Showing posts from December, 2001

DAX Shortcut Tables

  [ Measures] = {Blank()} [DAX DateDim] =  VAR BaseCalendar = CALENDAR ( date ( 2010, 1, 1) , today() ) RETURN // Create a date table with 1 line per day for the range 1/1/1990 to 31/12/2060 GENERATE ( BaseCalendar, VAR TodayDayCycle = (today() - date( 1989, 12, 17) * 1)-(14*((ROUNDUP(ABS((today() - date( 1989, 12, 17) * 1)/14),0))-1)) VAR Cycles = ([Date] - 36724) / 14 VAR PayCycle = (ROUNDDOWN(Cycles,0)+1)-(ROUNDDOWN(Cycles/26,0))*26 VAR DaysInCycle = ([Date] - date( 1989, 12, 17) * 1)-(14*((ROUNDUP(ABS(([Date] - date( 1989, 12, 17) * 1)/14),0))-1)) VAR GRCFiscalYear =ROUNDDOWN(Cycles/26,0)+2000 Return ROW ( "DayNo", day([Date]), // number of current date "Day ddd", Format([Date], "ddd"), //day name, Mon, Tue, Wed, etc  "DayInCycle", DaysInCycle*1, // number of days in paycycle "WeekNo", WEEKNUM([Date]), // Gregorian week number "WeekDay", if (or (Format([Date], "ddd") = "Sat", Format([Date], "ddd&qu