Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Why is the order wrong?

Hi Power BI Community

 

I have this measure 

 

but this is the result:

I tried to sort It in the right chronical order but there is no why.

Must I add an ID to sort it?

 

Thank you for your time

  • Anonymous's avatar
    Anonymous
    5 years ago

    mahoneypat  Thank you for your reply. 

    I did that and the order works but now it does show 0-2 and 2-5 as blank. 

3 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    You will need to add a sort by column.  You can use your same expression but return 1,2,3,4,5,6 instead of "0-2 Days", etc.

     

    Regards,

    Pat

    • Anonymous's avatar
      Anonymous
      Not applicable

      mahoneypat  Thank you for your reply. 

      I did that and the order works but now it does show 0-2 and 2-5 as blank. 

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    That's odd.  Please confirm the two terms in your DATEDIFF in your SWITCH is referencing two columns in that same table.  If either are measures, you would also need to consider the sort by column in any filter changes on your original switch column.  This approach should work, but another approach would be to make a disconnected table with your axis values (0-2 Days, etc.) and upper/lower limits.

     

    If that doesn't help, you can share link to the pbix (or a mock version of it) and I can get it working.

     

    Regards,

    Pat