Forum Discussion

PowerBI_AL2022's avatar
PowerBI_AL2022
Frequent Visitor
2 years ago
Solved

How to sort in QQ-YYYY format in chart?

Hi All , 

 

i have unorganized data in the below format , but the customer wants it to be displayed in the format 

 

1. X axis as quarter and by Month : ordered by the reversed timeline (Q2 2024 then Q1 2024 then Q4 2023 then Q3 2023 etc)

2. drill down layer as Month.

 

how do i use the dax to formulate this QQ-YYYY format , 

please help 

 

thanks in advance

  • Anonymous's avatar
    Anonymous
    2 years ago

    vanessafvg Thanks for your contribution on this thread.

    Hi PowerBI_AL2022 ,

    You can follow the steps below to get it:

    1. Create a calculated column as below to get the format Qx YYYY

    "Q"& QUARTER('Table'[Date])& " "&FORMAT('Table'[Date],"YYYY")

    2. Refer the following blog to sort the column by custom

    Sort a Column with a Custom Order in Power BI - RADACAD

    1. Create a customized sort order dimension table

    Quarter Year Order
    Q2 2024 1
    Q1 2024 2
    Q4 2023 3
    Q3 2023 4
    ... ...

    2. Combining the Sort Order Table with 'Dimension' table

    3. Sort by column



    Best Regards

2 Replies

  • vanessafvg's avatar
    vanessafvg
    Icon for Community Champion rankCommunity Champion

    are you getting that from a date table?

     

    if so just create a key in the data table comprising of  the quarterno and year ie 12022 as a number  then use this value to to sort the column 

  • Anonymous's avatar
    Anonymous
    Not applicable

    vanessafvg Thanks for your contribution on this thread.

    Hi PowerBI_AL2022 ,

    You can follow the steps below to get it:

    1. Create a calculated column as below to get the format Qx YYYY

    "Q"& QUARTER('Table'[Date])& " "&FORMAT('Table'[Date],"YYYY")

    2. Refer the following blog to sort the column by custom

    Sort a Column with a Custom Order in Power BI - RADACAD

    1. Create a customized sort order dimension table

    Quarter Year Order
    Q2 2024 1
    Q1 2024 2
    Q4 2023 3
    Q3 2023 4
    ... ...

    2. Combining the Sort Order Table with 'Dimension' table

    3. Sort by column



    Best Regards