need urgent help of yours:
I have a column Date (e.g. 01.01.2016), then I added columns Month and Year and concatenated them to get the column MonthYear(e.g. January2016):
Now the problem is, that I have date from 3 years(2016-2018) and I can not sort them correctly:
Here I sorted them by Month Number, but as you see, it doesn't work correctly. I can not sort them by column Date either, since I have multiple Date values for one MonthYear value.
So how could I sort MonthYear correctly, so that values Jan2017 and Feb 2017 will be shown after Months of 2016?
Could anyone help?
thanks a lot!
In case you want to sort by Year and Month of date, you could add Calcuated column for YearMonthInt as:
YearMonthInt = Dates[Date].[Year]*100 + Dates[Date].[MonthNo]
Then choose MonthYear column and choose sort by YearMonthInt column.
If this works for you please accept it as solution and also like to give KUDOS.
could you please also tell, how you concatenated MonthYear?
Question to this formula: YearMonthInt = Dates[Date].[Year]*100 + Dates[Date].[MonthNo] : is Dates the name of table? "Year" and "MonthNo" are your columns or DAX functions?
because in my case PowerBI underlines this formula as red: YearMonthInt = Client[Datum].[Jahr]*100 + Client[Datum].[Mon]
thank you kindly!
When we cast Date column to Date type, PBI will suport us to access its Month (month name) and Month value (MonthNo)
My MonthYear= Dates[Date].[Month] & "-" & Dates[Date].[Year]
I think your expression of YearMonthInt is correct, just choose sort by column.
hm, it is a bit strange, because I get error message from Power BI, that says : the variation column Month and Year couldn't be found in the table:
Table1 is name of my table; Date is name of my Date column; I have Date in format dd.mm.yyyy.
I tried both German and English in the formula for the Month and Year, but it doesn't work.
And the same problem with YearMonthInt = Dates[Date].[Year]*100 + Dates[Date].[MonthNo] --> in my report I get error message.
Is DATES in your report the name of your table?
thanks for the help!
yes, Dates is table name. Please ensure your data type of Date column is Date cause as my observation, i dont think your Date column is in Date type. So it doesnt support additional fields.
If you got problems with casting Date column, you could substring by left or Right method for your Date column and use Value() method to convert text to int.
means if multiple years data we have first it will sort by year in that case . But how to prepared calculate colum for above scenario as per above data. help me here i am new to DAX querys. also not having date column in my all tables so please suggest me how to achive that sorting on multiple year data
For others with similar problems:
How to arrange PowerBI date labels chronologically:
If a Visual is distored because the date labels are aranged aphabetical (e.g.: April 2017; August 2017; .. ) instead of chronological (e.g. January 2017; February 2017), then you need to sort your datelabels column by a chronological column on the same table.
The easiest way is to create a new column with an int representation (e.g. 201701) of the datelabels column (January 2017) that you want to sort chronologically. Next, sort you column by the new column that contains the int values.
Unfortunately, it is not possible to sort the MonthYearShort column by a column such as Date or DateInt because every value needs to match exactly one value in the column that will be sorted by. So you need to add a new column:
YearMonthInt = FORMAT ( Dates[Date]; "YYYYMM" ) // or any other format that suits your text column
Now each datelabel matches one int value: jan.17 => 201701; feb.17 => 201702
The next step is to select the text column (MonthYearShort) and click Sort By and select the int column YearMonthInt, see link:
hey @tringuyenminh92 you did a great gob in finding the trick for this common issue. Congratulations!!
I have a small issue, i did created similar kind of column and i did sorting also based on that column but my visuals are not getting sort, based on the new column rather i can't see any effect on my visuals.
If possible, post some sollution for it.
Thanks in advance.
Check out a full recap of the month!
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.