Forum Discussion

james_wood's avatar
james_wood
Frequent Visitor
4 years ago
Solved

How do I sort columns chronologically in stacked column chart?

I have the following stacked column chart. January is the only month for 2022, all others are for 2021. Let's label each column A, B, C, D for confidential purposes. Hopefully you can see that Januar...
  • Pragati11's avatar
    4 years ago

    Hi james_wood ,

     

    What you can do is create a MONTH-YEAR column in Power BI using your DATE column.

    Check this article on how to get this Month-Year column:

    https://radacad.com/generate-year-and-month-combinations-in-power-bi-report-using-dax

     

    Next I created stacked bar chart with the following information:

     

    You can see that at the top stack I see the one for Jan-2019, though I want the latest Month as the top stack which is Mar-2019.

     

    So just sort your legend as shown below:

    So when I did a sort on my LEGEND, I can see the latest month-year appearing as the top stack on the chart.

     

    Let me know if this helps.

     

    Thanks,

    Pragati