Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hi there,
Everyday, I want to add a dynamic filter looking at two day's ago with the the earliest time. For example for this morning: today is 2022-12-08. I want to get: 2022-12-08-0-0-0. Here is what i got:
let
Source = DateTime.LocalNow(),
#"Converted to Table" = #table(1, {{Source}}),
#"Added Custom1" = Table.AddColumn(#"Converted to Table", "Custom.1", each Date.AddDays([Column1],-2)),
#"date and time" = #"Added Custom1"{0}[Custom.1]
in
#"date and time"
It's pulling the current 2 day's ago date and time. I always want midnight.
Solved! Go to Solution.
Hi @dave_schultz ,
Try the Date.StartOf Day function. It returns the start of the day represented by dateTime. dateTime must be a date, datetime, or datetimezone value.
let
Source = DateTime.LocalNow(),
#"Converted to Table" = #table(1, {{Source}}),
#"Added Custom1" = Table.AddColumn(#"Converted to Table", "Custom.1", each Date.StartOfDay(Date.AddDays([Column1],-2)))
in
#"Added Custom1"
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @dave_schultz ,
Try the Date.StartOf Day function. It returns the start of the day represented by dateTime. dateTime must be a date, datetime, or datetimezone value.
let
Source = DateTime.LocalNow(),
#"Converted to Table" = #table(1, {{Source}}),
#"Added Custom1" = Table.AddColumn(#"Converted to Table", "Custom.1", each Date.StartOfDay(Date.AddDays([Column1],-2)))
in
#"Added Custom1"
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous - Yes, this answered my question. Thank you!
David
You could try converting the date time to just a date (I think that would make it midnight) with something like:
DateTime.Date(DateTime.LocalNow())
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 |
|---|---|
| 52 | |
| 39 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 66 | |
| 34 | |
| 32 | |
| 29 |