Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Muy buenas.
Estoy intentando crear una columna con la semana iso en el editor de power query en powor bi.
He encontrado esta formula, la cual pego en una columna personalizada, pero al ejecutarla me da error en los datos.
La fórmula de Ron de Bruin, trasladada al lenguaje M de Power Query queda como sigue:
Number.RoundDown((Int64.From([Fecha])- Int64.From(#date(Date.Year(Date.From(Int64.From([Fecha])-(if (Date.DayOfWeek(Date.AddDays([Fecha],1)))=0 then 7 else (Date.DayOfWeek(Date.AddDays([Fecha],1))))+4)),1,3))+
(if (Date.DayOfWeek(Date.AddDays((#date(Date.Year(Date.From(Int64.From([Fecha])-(if (Date.DayOfWeek(Date.AddDays([Fecha],1)))=0 then 7 else (Date.DayOfWeek(Date.AddDays([Fecha],2))))+4)),1,3)),1)))=0
then 7 else (Date.DayOfWeek(Date.AddDays((#date(Date.Year(Date.From(Int64.From([Fecha])-(if (Date.DayOfWeek(Date.AddDays([Fecha],1)))=0 then 7 else (Date.DayOfWeek(Date.AddDays([Fecha],1))))+4)),1,3)),2))))+5)/7)
Alguna ayuda, Gracias
Solved! Go to Solution.
Hi @JUAN_1969
To get ISO week from a date with M codes, you can refer to this page on GitHub: M functions to convert between ISO 8601 Week & Year ⇄ dates
Also, I have an example in this thread which shows how to use this custom function.
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Gracias es muy colaboración
Hi @JUAN_1969
Have you solved this problem? If so, you may accept the appropriate post as the solution or post your own solution to help other members find it quickly. Thanks.
Regards,
Community Support Team _ Jing
Hi @JUAN_1969
To get ISO week from a date with M codes, you can refer to this page on GitHub: M functions to convert between ISO 8601 Week & Year ⇄ dates
Also, I have an example in this thread which shows how to use this custom function.
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.