Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
maclura
Resolver I
Resolver I

Date Table - DAX - CALENDAR() - ADDCOLUMNS() - Quarter Issue

Hi,

I create a new Date table with DAX using the CALENDAR() function.
Adding new columns, no problem. When I add a new "Quarter" colum into the table my table stops starting from Jan 1st and move to start from Jul 1st.
I can't understand why. Any help greatly appreciated.

First Variant (correct)

 

 

Date = 
    VAR MinDate = DATE(2016,1,1)
    VAR MaxDate = DATE(2021,12,31)
    RETURN

    ADDCOLUMNS (
        CALENDAR(MinDate, MaxDate),
        "Calendar Year", "CY " & YEAR ([Date])
    )

 

 

Result

image.png

Second Variant (wrong)

 

 

Date = 
    VAR MinDate = DATE(2016,1,1)
    VAR MaxDate = DATE(2021,12,31)
    RETURN

    ADDCOLUMNS (
        CALENDAR(MinDate, MaxDate),
        "Calendar Year", "CY " & YEAR ([Date]),
        "Calendar Quarter", "CQ " & QUARTER([Date])
    )

 

Result

image.png

Where I am wrong?
Thanks

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Hi, @maclura , no worries, those other before July are not gone with the wind; but the mechnism under the hood is not clear.

Screenshot 2020-12-10 193326.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

Hi, @maclura , no worries, those other before July are not gone with the wind; but the mechnism under the hood is not clear.

Screenshot 2020-12-10 193326.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

I just had the same issue.  It is really weird that it would do that.  I had to sort the date column in mine asc to see it begining on 1/1/YYYY.

Thank you @CNENFRNL . 
If I was a little more savvy, I would have to get there on my own. But I agree with you, why generated dates are sorted in that way?

After some other tests, I think it should be something related to a chaching mechanism.
In fact, sorting issues happen not only with rows, but also with columns, when you add more columns into the formula. The new columns are created regardless of their position in the formula.
If you create a new date table, when you run the formula the first time, columns are created in the order they appear into the formula.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors