Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello
I have the following table
Current, i am unable to change the data type of the column to DateTime, as the value with Today or Yesterday are not recognised as date.
How can i replace the word Today with Today Date and yesterday with Yesterday's date.
So i can change the data type to DateTime?
Thanks
Solved! Go to Solution.
Hi @PPStar ,
You can make a little adjustment base on the reply from @mh2587 ,please find details in the attachment.
=if Text.Contains([Start time], "Today") then
DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & Text.AfterDelimiter([Start time], ",")
else if Text.Contains([Start time], "Yesterday") then
DateTime.ToText(DateTime.From(DateTime.LocalNow() - #duration(1, 0, 0, 0)), "yyyy-MM-dd")
& Text.AfterDelimiter([Start time], ",")
else
[Start time]
Best Regards
= if Text.Contains([YourColumnName], "Today") then DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd")
else if Text.Contains([YourColumnName], "Yesterday") then DateTime.ToText(DateTime.From(DateTime.LocalNow() - #duration(1, 0, 0, 0)), "yyyy-MM-dd")
else [YourColumnName]
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
Hello, this almost works.
The only issue is the time. I thikn using the dd/MM/yyyy HH:MM:ss shows todays date and todays time, but i need it to show the time on the table
E.g if you look at the 2nd row, it says Today, 07:00 . So the new column shows it as 20/11/2023 12:11:11, where 12:11:11 is the Hour, Minute Second NOW.
Any ideas?
Thanks
Hi @PPStar ,
You can make a little adjustment base on the reply from @mh2587 ,please find details in the attachment.
=if Text.Contains([Start time], "Today") then
DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & Text.AfterDelimiter([Start time], ",")
else if Text.Contains([Start time], "Yesterday") then
DateTime.ToText(DateTime.From(DateTime.LocalNow() - #duration(1, 0, 0, 0)), "yyyy-MM-dd")
& Text.AfterDelimiter([Start time], ",")
else
[Start time]
Best Regards
User | Count |
---|---|
99 | |
87 | |
81 | |
76 | |
71 |
User | Count |
---|---|
112 | |
105 | |
96 | |
74 | |
66 |