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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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