Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Sort Month Year Chronologically

hello and thank you in advance for any help offered.

I've searched through the forums and found a lot of solutions but none of them have worked. The ones I've tried are listed below

 

280635 

957680 

299044 

 

I am using DirectQuery data for my mode and I have created a DateKey table and created a relationship between that and my data table. The data is a view from SQL. In my DateKey table I have a column created as 
YnMnAsInteger = (DateKey[Year])&FORMAT(DateKey[Date],"MM")

The relationship is between DOI_Date and MnYn = FORMAT(DateKey[Date],"MM")&"/" &DateKey[Year]. 

When I choose Sort by Column | YnMnAsInteger nothing changes.

 

I'm not sure what I'm missing.

 

  • Anonymous 

    In your table, Month-year should have been sorted or MonthyearInt or Sort column.

    In YYYYMM format.

    Also, the month year which uses in the report/visual should come from the same table as a sort column.

16 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak, I have a column setup already, MonthY. I added that to the Axis entry along with the DOI_Date from the data table and again nothing changed.

       

      In the relationship screen there is a warning message, "This relationship has cardinality Many-Many. This should...." it won't let me change it. Could that be causing my issue?

       

      David

       

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

        Yes. Avoid many-to-many unless you really need it. Bridge Tables generally work better for most use cases, and avoid problems M2M can cause.