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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RoyG
New Member

Get first date of ISO year

Hello,

 

Is there a Dax code to get the first date of any given ISO year?

 

When I want to calculate the first date of a calender year then I use something like: 

VAR FirstDate = date(year(SelectedDate),1,1)
 
In this particular case I am looking for the first date in an ISO year. For example ISO year 2023 started on January 2nd as January 1st 2023 belongs to the ISO year 2022.  Similarly, ISO year 2021 started on January 4th.
 
Curious to see if anyone has a creative idea how to get to this date in DAX.
1 ACCEPTED SOLUTION
RoyG
New Member

In case anyone is interested, I figured out a solution:

VAR FirstDate = date(year(SelectedDate),1,1)
VAR FirstISODate = if(weekday(FirstDates,2)<=4,FirstDates - weekday(FirstDates,2) + 1,FirstDates - weekday(FirstDates,2)+ 8)
This is based on the ISO rule: if 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in W01 (weekday 1 to 4). Otherwise it's part of the previous year.

View solution in original post

2 REPLIES 2
RoyG
New Member

In case anyone is interested, I figured out a solution:

VAR FirstDate = date(year(SelectedDate),1,1)
VAR FirstISODate = if(weekday(FirstDates,2)<=4,FirstDates - weekday(FirstDates,2) + 1,FirstDates - weekday(FirstDates,2)+ 8)
This is based on the ISO rule: if 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in W01 (weekday 1 to 4). Otherwise it's part of the previous year.

Hi Roy, it does not allow for the first isoday being in the previous calendar year. That will be a problem in a year.

It is because the First Date is looking at the current year of the row, you want it to look at the first of januari of the iso year; so FirstDate = date( YearISO, 1, 1 )

VAR YearISO =
            IF (
                AND ( WeekISO < 5, WeekUS2 > 50 ),
                YearDate + 1,
                IF ( AND ( WeekISO > 50, WeekUS2 < 5 ), YearDate - 1, YearDate )
            )




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.