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
JUAN_1969
Helper I
Helper I

Obtener fecha de cada lunes, sabiendo nº de semana y año

Muy buenas.

 

Tengo una tabla que me viene con el numero de la semana iso y el año, y necesito con estos dos datos obtener la fecha que le corresponde a cada lunes.

Necesito crearlo en el editor de power query desde power bi.

 

Gracias por vuestra ayuda.

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @JUAN_1969 ,

 

You might consider creating a new date table and filtering out the Monday dates, like this.

vcgaomsft_0-1679537683783.png

Then merge queries.

vcgaomsft_1-1679537754883.png

Add custom columns to complete the missing dates at the beginning and end of the year.

vcgaomsft_2-1679537798687.png

= if [Column1] = null then try Date.AddDays(Table.SelectRows(#"Expanded Query1",(x)=>[Year]=x[Year] and [Week]+1=x[Week])[Column1]{0},-7) otherwise Date.AddDays(Table.SelectRows(#"Expanded Query1",(x)=>[Year]=x[Year] and [Week]-1=x[Week])[Column1]{0},7) else [Column1]

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @JUAN_1969 ,

 

You might consider creating a new date table and filtering out the Monday dates, like this.

vcgaomsft_0-1679537683783.png

Then merge queries.

vcgaomsft_1-1679537754883.png

Add custom columns to complete the missing dates at the beginning and end of the year.

vcgaomsft_2-1679537798687.png

= if [Column1] = null then try Date.AddDays(Table.SelectRows(#"Expanded Query1",(x)=>[Year]=x[Year] and [Week]+1=x[Week])[Column1]{0},-7) otherwise Date.AddDays(Table.SelectRows(#"Expanded Query1",(x)=>[Year]=x[Year] and [Week]-1=x[Week])[Column1]{0},7) else [Column1]

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

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.