Forum Discussion

JustinDoh1's avatar
JustinDoh1
Icon for Post Prodigy rankPost Prodigy
2 years ago
Solved

Need some help with Date (bridge) table for drop down menu

I am trying to make my Date table work by possibly adding a column (or possibly a logic) so that I could Sort properly.   I have uploaded my PowerBI file here.   As you can see on the bottom scre...
  • DataNinja777's avatar
    2 years ago

    Hi JustinDoh1 ,

    There are multiple ways to achive your required sort order and one of them is to use the calculated calendar table and summarize it for the month year field, and then sort "mmmm yyyy" field which was alphabetically sorted originally by "yyyy-mm" to ensure that the sort order respects numerical month order instead of alphabetical sort order.  

    A calculated calendar table with month granularity can be produced by the following dax formula.  

    Calendar month =
    SUMMARIZE (
        ADDCOLUMNS (
            CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2024, 12, 31 ) ),
            "yyyy-mm", FORMAT ( [Date], "yyyy-mm" ),
            "mmm-yyyy", FORMAT ( [Date], "mmm-yyyy" ),
            "mmmm yyyy", FORMAT ( [Date], "mmmm yyyy" )
        ),
        [mmm-yyyy],
        [mmmm yyyy],
        [yyyy-mm]
    )

    Then, you can create a calculated column in the calculated calendar table to identify the Current month from your fact table.  

    You can fix the sorting issue of "mmmm yyyy" by using the following user interface in the table view.  

    The resultant output shows the properly sorted mmmm yyyy field which identifies Current month properly.

    This is one of many ways to achive your required output. I attach an example pbix file.  

    Best regards,