Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All -
i am really new in Power BI, even i can say, i just know power BI for 1 week 🙂
anyway, i want to create "filter validate date" for my references in query editor.
currently i able (found) to get yesterday date, but i want to have scenario where if today is monday then it will get Friday date not sunday,
this is to get yesteday date =
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1)
now if today is monday, then the formula should be =
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-3)
how to combine this into 1 formula in query editor?
Thanks in advance
Solved! Go to Solution.
Hi @rezaaditia ,
could you please show me the error details?
because it works on my sample.
Aiolos Zhao
Proud to be a Super User!
Hi @rezaaditia ,
You can use a function called Date.DayOfWeek().
eg.
if Date.DayOfWeek([Date]) = 1 then adddays(-3) else adddays(-1)
Please try.
Aiolos Zhao
Proud to be a Super User!
Hi @rezaaditia ,
you need to put your column name into your date.adddays() function,
like :
date.adddays(your_date_column, -3)
please make sure the type of your_date_column is date.
Aiolos Zhao
Proud to be a Super User!
Hi @AiolosZhao
thank you for your help so far, your formula given is working, but not fit into my dashboard.
i don't want to put specific columns in formula, i want to use general date. can we create it using DateTime.FixedLocalNow()
I did try, but shows error... can you please suggest
if Date.DayOfWeek([Date]) = 1 then
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-3)
else
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1)
thanks again
Hi @rezaaditia ,
could you please show me the error details?
because it works on my sample.
Aiolos Zhao
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |