Forum Discussion
francofava
3 years agoNew Member
Reverse sort in date table
I have created a date table using the code below. Accounting_Posting_Date = ADDCOLUMNS ( CALENDAR (DATE(2015,1,1), DATE(2030,12,31)), "DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ), "...
- 3 years ago
I've managed to solve it by adding the column directly when creating the table and then referring to it when sorting the other columns
Accounting_Posting_Date =ADDCOLUMNS (CALENDAR (DATE(2015,1,1), DATE(2030,12,31)),"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),"Period", FORMAT ( [Date], "YYYYMM" ),"Year", YEAR ( [Date] ),"Monthnumber", FORMAT ( [Date], "MM" ),"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),"MonthNameShort", FORMAT ( [Date], "mmm" ),"MonthNameLong", FORMAT ( [Date], "mmmm" ),"DayOfWeekNumber", WEEKDAY ( [Date] ),"DayOfWeek", FORMAT ( [Date], "dddd" ),"DayOfWeekShort", FORMAT ( [Date], "ddd" ),"Quarter", "Q" & FORMAT ( [Date], "Q" ),"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ),"Period_rank", -value(FORMAT ( [Date], "YYYYMM" )))
francofava
3 years agoNew Member
I've managed to solve it by adding the column directly when creating the table and then referring to it when sorting the other columns
Accounting_Posting_Date =
ADDCOLUMNS (
CALENDAR (DATE(2015,1,1), DATE(2030,12,31)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Period", FORMAT ( [Date], "YYYYMM" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ),
"Period_rank", -value(FORMAT ( [Date], "YYYYMM" ))
)