Forum Discussion
Convert from DAX to M
Hi, I have a dynamic calendar table created in DAX and wonder if this is possible to have in M?
HelloAnonymous
there are for sure multiple ways to create this table. Here one simple approach
let Today = Date.From(DateTime.FixedLocalNow()), CreateCalendareList = {Date.AddDays(Today, -2), Date.AddDays(Today, -9), Date.AddDays(Today, -16), Date.AddDays(Today, -23)}, ConvertListToTable = Table.FromList(CreateCalendareList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), ChangeType = Table.TransformColumnTypes(ConvertListToTable,{{"Column1", type date}}), RenameColumn = Table.RenameColumns(ChangeType,{{"Column1", "Date"}}) in RenameColumnCopy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
1 Reply
- Jimmy801Community Champion
HelloAnonymous
there are for sure multiple ways to create this table. Here one simple approach
let Today = Date.From(DateTime.FixedLocalNow()), CreateCalendareList = {Date.AddDays(Today, -2), Date.AddDays(Today, -9), Date.AddDays(Today, -16), Date.AddDays(Today, -23)}, ConvertListToTable = Table.FromList(CreateCalendareList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), ChangeType = Table.TransformColumnTypes(ConvertListToTable,{{"Column1", type date}}), RenameColumn = Table.RenameColumns(ChangeType,{{"Column1", "Date"}}) in RenameColumnCopy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy