Forum Discussion
Direct Query - Multiple sorting in 100% stacked bar chart by Akvelon 1.2.3
Icey I haven't test for other visuals because I really need to use this plug-in one as it suits our needs with multiple variables.
Do you mind to share your testing file with proper sortings for both of the Timestamp and Description?
Thanks!
Best regards,
Emily
Hi Anonymous ,
Please check the attached .pbix file. I tested with SQL Server Datebase.
Best Regards,
Icey
- Anonymous6 years agoNot applicable
Icey Sorry that I can't open your file as it needs SQL Server credentials for your DB.....
Are you able to upload sample static data for the Sales table with Import mode?
Thanks!
Best regards,
Emily
- Icey6 years agoCommunity Support
Hi Anonymous ,
Please check.
Best Regards,
Icey
- Anonymous6 years agoNot applicable
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