Forum Discussion
Direct Query - Multiple sorting in 100% stacked bar chart by Akvelon 1.2.3
Icey Thank you very much for your sample file.
I tried it in my computer and the sorting is correct for both of the [Timestamp] and [Description] in your file.
However, it is still not working from my end because my [Timestamp] is a string format rather than a date format. Since I need to use Direct Query for my report, I intentionally created a [Timestamp] table in string format because SQL Server do not have default format in dd-MMM-yyyy format.
Here is what I have done in Power Query to get the Timestamp in string format.
Power Query result from the above Timestamp_SQL query:
In the PowerBI screen, I select [Timestamp_Date] and choose "Sort by Column" from the top menu then sort it by [1st Occurence Timestamp] which is identified as DATE field in PowerBI.
Going back to the chart visual, I put Timestamp_SQL[Timestamp_Date] as the "Column By" in the chart and Sort By Timestamp_SQL[Timestamp_Date] in descending order. Since the sorting for both of the [Description] and [Timestamp] is based on another table rather than based on the fact table, so it results to the following problem.
I have tried your way to only drag & drop the Timestamp field into "Column By" of the chart but that results to a wrong date format just like what is shown in your sample. Tha was the reason why I manually converted the [Timestamp] from date format to string format, and I put the string format of Timestamp into the chart.
Any idea how to solve the above problem?
Thanks a lot!
Best regards,
Emily
Hi Anonymous ,
I changed my model based on your description, but no issue.
Do you mind creating a dummy file to reproduce the issue and sharing it to me? Please remove sensitive information. It is suggested to upload your file to OneDrive for Business and then paste the link here.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
Icey I tried to re-do another file with Import mode and did similar chart as before. I reproduced the problem in the following file and you can download at the following link in Gdrive:
https://drive.google.com/file/d/1QK4Kq4xAnY0CZuQx9yE7Ld3ac0NU2Ftt/view?usp=sharing
Thanks!
Best regards,
Emily