Forum Discussion
Line and Stacked Column Sorting Issue
Didn't quite get what you mean, That table is a data tble itself. I cant sort the period numer field on the chart as per the second image.
- calerof6 years agoImpactful Individual
smjzahid ,
It's difficult to help if you don't share a sample of your data. But do this:
Creat a new table and insert this code:
Calendar = ADDCOLUMNS( CALENDAR(DATE(2010, 1, 1), DATE(2020, 12, 31) ), "Year", YEAR([Date] ), "Quarter", "Q" & FORMAT( [Date], "Q" ), "MonthNum", FORMAT( [Date], "MM" ), "Month", FORMAT( [Date], "mmm" ), "YearMonth", FORMAT( [Date], "YYYY-MMM" ), "YearMonthNum", FORMAT([Date], "YYYYMM"), "WeekDayNum", WEEKDAY( [Date], 2 ), "WeekDay", FORMAT( [Date], "ddd" ), "WeekNum", WEEKNUM( [Date], 2 ), "Day", DAY( [Date] ), "YearQuarter", FORMAT( [Date], "YYYY" ) & "/Q" & FORMAT( [Date], "Q" ), "YearQuarterNumber", FORMAT( [Date], "YYYY" ) & FORMAT( [Date], "Q" ) )Mark it as Date Table.
Then make the relationship from the Date field to your table where the date is. If you don't have a date, only the period, i.e. 2020-01, then you go to the Query Editor and create a column from example selecting the Period Column, like this:
Make sure that new column is Date format. Close and apply.
That would be your Date key field from which you need to create a relationship with the date table.
Create your visual with your values and use from the Calendar table Year Month in the X axis.
And sort that field ascending.
And there you go.
Hope it helps.
Regards,
Fernando