Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I face issue in implementing a formula in power query
Formula is: If date in Column A is equal to today's date or yesterday's date or tomorrow's date then result is T else F.
Please guide me.
Solved! Go to Solution.
@MayAnk__Rathi Open your Power Query editor.
Add a new custom column.
Use the following formula in the custom column:
let
Today = Date.From(DateTime.LocalNow()),
Yesterday = Date.AddDays(Today, -1),
Tomorrow = Date.AddDays(Today, 1)
in
if [ColumnA] = Today or [ColumnA] = Yesterday or [ColumnA] = Tomorrow then "T" else "F"
Proud to be a Super User! |
|
Hi @MayAnk__Rathi,
Thank you @bhanu_gautam for the response to the query.
I'm glad you found a solution and resloved the query. Kindly mark the useful reply as the accepted solution so that others in the community can find it quickly.
Thankyou for connecting with Microsoft Community Forum.
use the following formula
let
today = Date.From(DateTime.LocalNow()),
value = [Column A],
result = if value = today or value = Date.AddDays(today, -1) or value = Date.AddDays(today, 1) then "T" else "F"
in
result
if Number.Abs(Number.From(Date.From(DateTime.LocalNow())-[ColumnA]))<=1 then "T" else "F"
Stéphane
let
Source = Excel.CurrentWorkbook(){[Name="Table1_2"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each let
today = Date.From(DateTime.LocalNow()),
yesterday = Date.AddDays(today, -1),
tomorrow = Date.AddDays(today, 1)
in
if [date] = today or [date] = yesterday or [date] = tomorrow then "T" else "F")
in
#"Added Custom"
@MayAnk__Rathi Open your Power Query editor.
Add a new custom column.
Use the following formula in the custom column:
let
Today = Date.From(DateTime.LocalNow()),
Yesterday = Date.AddDays(Today, -1),
Tomorrow = Date.AddDays(Today, 1)
in
if [ColumnA] = Today or [ColumnA] = Yesterday or [ColumnA] = Tomorrow then "T" else "F"
Proud to be a Super User! |
|
yes, now formula is working.
Thanks 👍👍
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 5 | |
| 5 |