Forum Discussion

Prima_'s avatar
Prima_
Icon for Resolver I rankResolver I
3 years ago
Solved

Display week numbers in correct order in x axis

I display week on the x-axis. I want 1st week of Jan 2023 to be added in the end after week 52, 2022.

 

 

So, I created a column yr_wk

yr_wk = 'XMLPI Version Compliance'[Year]*100 + 'XMLPI Version Compliance'[Week]

 

 

Now, it displays

Why doesn’t it display in sequence? And, how is 202352 added? It should be just 202301 (1st week of Jan). Could anyone help how to fix this?

Thank you.

  • Prima_'s avatar
    Prima_
    3 years ago

    Hi,

    Thanks for your reply.

    yr_wk = 'XMLPI Version Compliance'[Year]*100 + 'XMLPI Version Compliance'[Week] 

    works. I forgot to sort by yr_wk. After sorting by yr_wk, the week is displayed in correct order.

     

     

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Prima_ ,

    It's glad to hear that your problem has been resolved. And thanks for sharing your solution here. Could you please mark your post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours.  Thank you.

    Best Regards

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Prima_ ,

    Please update the formula of calculated column [yr_wk] as below and check if it can display as expected...

    yr_wk =
    'XMLPI Version Compliance'[Year]
        & IF (
            'XMLPI Version Compliance'[Week] < 10,
            "0" & 'XMLPI Version Compliance'[Week],
            'XMLPI Version Compliance'[Week]
        )

     

    If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards

    • Prima_'s avatar
      Prima_
      Icon for Resolver I rankResolver I

      Hi,

      Thanks for your reply.

      yr_wk = 'XMLPI Version Compliance'[Year]*100 + 'XMLPI Version Compliance'[Week] 

      works. I forgot to sort by yr_wk. After sorting by yr_wk, the week is displayed in correct order.

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Prima_ ,

        It's glad to hear that your problem has been resolved. And thanks for sharing your solution here. Could you please mark your post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours.  Thank you.

        Best Regards