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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
svishwanathan
Helper III
Helper III

Help with power query

Hello

 

I would like to identify if a date falls within DST (daylight saving) or not.

 

This works fine in excel

 

IF(AND(SysDate[SysDate]>=DATE(YEAR(SysDate[SysDate]),3,1)+14-WEEKDAY(DATE(YEAR(SysDate[SysDate]),3,1)-1), SysDate[SysDate] < DATE(YEAR(SysDate[SysDate]),11,1)+7-WEEKDAY(DATE(YEAR(SysDate[SysDate]),11,1)-1)),"DST","No")

 

Can anyone please help me to write this in power query

 

I know that the commas need to go and I need to put then and els

 

But I think I cannot use the syntax I am using to return the date for the second sunday in march and 1st sunday in november

 

Regards

Swati

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@svishwanathan wrote:

Hello

 

I would like to identify if a date falls within DST (daylight saving) or not.

 

This works fine in excel

 

IF(AND(SysDate[SysDate]>=DATE(YEAR(SysDate[SysDate]),3,1)+14-WEEKDAY(DATE(YEAR(SysDate[SysDate]),3,1)-1), SysDate[SysDate] < DATE(YEAR(SysDate[SysDate]),11,1)+7-WEEKDAY(DATE(YEAR(SysDate[SysDate]),11,1)-1)),"DST","No")

 

Can anyone please help me to write this in power query

 

I know that the commas need to go and I need to put then and els

 

But I think I cannot use the syntax I am using to return the date for the second sunday in march and 1st sunday in november

 

Regards

Swati


@svishwanathan

It doesn't have to use Power Query, in DAX, the formula is the same. Any reason why not using DAX?

Capture.PNG

dstDayOrNot = IF(
    AND(
        SysDate[SysDate] >=
        DATE(
            YEAR(
                SysDate[SysDate]
            ),
            3,
            1
        ) + 14 -
        WEEKDAY(
            DATE(
                YEAR(
                    SysDate[SysDate]
                ),
                3,
                1
            ) - 1
        ),
        SysDate[SysDate] <
        DATE(
            YEAR(
                SysDate[SysDate]
            ),
            11,
            1
        ) + 7 -
        WEEKDAY(
            DATE(
                YEAR(
                    SysDate[SysDate]
                ),
                11,
                1
            ) - 1
        )
    ),
    "DST",
    "No"
)

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@svishwanathan wrote:

Hello

 

I would like to identify if a date falls within DST (daylight saving) or not.

 

This works fine in excel

 

IF(AND(SysDate[SysDate]>=DATE(YEAR(SysDate[SysDate]),3,1)+14-WEEKDAY(DATE(YEAR(SysDate[SysDate]),3,1)-1), SysDate[SysDate] < DATE(YEAR(SysDate[SysDate]),11,1)+7-WEEKDAY(DATE(YEAR(SysDate[SysDate]),11,1)-1)),"DST","No")

 

Can anyone please help me to write this in power query

 

I know that the commas need to go and I need to put then and els

 

But I think I cannot use the syntax I am using to return the date for the second sunday in march and 1st sunday in november

 

Regards

Swati


@svishwanathan

It doesn't have to use Power Query, in DAX, the formula is the same. Any reason why not using DAX?

Capture.PNG

dstDayOrNot = IF(
    AND(
        SysDate[SysDate] >=
        DATE(
            YEAR(
                SysDate[SysDate]
            ),
            3,
            1
        ) + 14 -
        WEEKDAY(
            DATE(
                YEAR(
                    SysDate[SysDate]
                ),
                3,
                1
            ) - 1
        ),
        SysDate[SysDate] <
        DATE(
            YEAR(
                SysDate[SysDate]
            ),
            11,
            1
        ) + 7 -
        WEEKDAY(
            DATE(
                YEAR(
                    SysDate[SysDate]
                ),
                11,
                1
            ) - 1
        )
    ),
    "DST",
    "No"
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.