March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
In the following table, I want to add 2 new columns with name Overdue and due in 90 days) with values true or false. How Can I do that ?
Document Type | Latest Date |
Certificate 1 | 3/1/2022 |
Certificate 2 | 1/31/2024 |
Layout Design | 7/1/2022 |
Statement 1 | 7/1/2022 |
Statement 2 | 3/1/2022 |
Processes Description | 10/1/2024 |
Flow Diagram | 10/1/2024 |
Floor Plan | 7/1/2022 |
Schedule 1 | 1/31/2024 |
Schedule 2 | 7/1/2022 |
List 1 | 7/1/2022 |
List 2 | 7/1/2022 |
Schedule A | 3/1/2022 |
Schedule Y | 3/1/2022 |
Schedule G | 3/1/2022 |
Solved! Go to Solution.
Put following formulas
For Overdue
= Date.From(DateTime.FixedLocalNow())>[Latest Date]
For Due in 90 days
= Date.IsInNextNDays([Latest Date],90)
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc89C8IwEAbgvxIyF9KkgrNYdOlQcJLSIcSzHrSNJCnivzeNEPq55sm9d29V0TMYh09U0gHhNKEZ40ykQtA6maPwyFkW9BC0kF89OJKDxab3epyO3pwf6qB3IXWHxHJhabQCa8GOqcrg26Eeo3nKJosvrf6QHGVjZLeF2pCyleuT1AseQ/vvOa8SSSyHCrQbFcLr6m9MOS17RbnvynUm9Q8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Document Type" = _t, #"Latest Date" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Document Type", type text}, {"Latest Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Overdue", each Date.From(DateTime.FixedLocalNow())>[Latest Date]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Due in 90 days", each Date.IsInNextNDays([Latest Date],90))
in
#"Added Custom1"
Put following formulas
For Overdue
= Date.From(DateTime.FixedLocalNow())>[Latest Date]
For Due in 90 days
= Date.IsInNextNDays([Latest Date],90)
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc89C8IwEAbgvxIyF9KkgrNYdOlQcJLSIcSzHrSNJCnivzeNEPq55sm9d29V0TMYh09U0gHhNKEZ40ykQtA6maPwyFkW9BC0kF89OJKDxab3epyO3pwf6qB3IXWHxHJhabQCa8GOqcrg26Eeo3nKJosvrf6QHGVjZLeF2pCyleuT1AseQ/vvOa8SSSyHCrQbFcLr6m9MOS17RbnvynUm9Q8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Document Type" = _t, #"Latest Date" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Document Type", type text}, {"Latest Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Overdue", each Date.From(DateTime.FixedLocalNow())>[Latest Date]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Due in 90 days", each Date.IsInNextNDays([Latest Date],90))
in
#"Added Custom1"
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.