Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All!
This is my 1st post.
So...I've this query (it works well):
let
Source = Sql.Database("Server123", "abc"),
dbo_xyz = Source{[Schema="dbo",Item="xyz"]}[Data],
#"Accepted equals 0" = Table.SelectRows(dbo_xyz, each [Accepted] = 0),
#"Changed date/time to date" = Table.TransformColumnTypes(#"Accepted equals 0",{{"StartDay", type date}}),
#"StartDate before today" = Table.SelectRows(#"Changed date/time to date", each [StartDay] < DateTime.Date(DateTime.LocalNow()))
in
#"StartDate before today"
What I want to do is instead of putting "DateTime.Date(DateTime.LocalNow()))" is to put my function Today, which is pretty much the same code:
() =>
let
Source = DateTime.Date(DateTime.LocalNow())
in
Source
I try to learn something, but when I do something like:
#"StartDate before today" = Table.SelectRows(#"Changed date/time to date", each [StartDay] < Today)
I gain an error power bi cannot compare function with date...I get it, I need somehow to force m query to return result of Today instead of comparing Today, but I don't know how...I tried as well Function.Invoke but it needs 2 parameters (function and arguments, in my case it's very simple function with no args). Is it even possible? Is my fucntion missing something?
Solved! Go to Solution.
Normally you have to call the function with (), so Today().
To test this function, you should add a column using Today(). That way you can prove that the function works before using it in a comparison
Normally you have to call the function with (), so Today().
To test this function, you should add a column using Today(). That way you can prove that the function works before using it in a comparison