Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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!
User | Count |
---|---|
95 | |
86 | |
78 | |
72 | |
66 |
User | Count |
---|---|
113 | |
105 | |
84 | |
65 | |
64 |