Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi all,
I am trying to do something similar with the below Alteryx expression. In the API URL, I want to include the date parameter. So if powerbi refreshes on Monday, it will lookback 3 days before which is friday. Else it will just lookback yesterday's date. My PowerBI advanced editor only can look back to yesterday's date. How can I extend to include the IF THEN ELSE statement?
Alteryx:
IF DateTimeFormat(DateTimeToday(),"%A") = "Monday"
THEN [FX URL] + DateTimeFormat(DateTimeAdd(DateTimeToday(),-3,"days"),"%Y%m%d")
ELSE [FX URL]+DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"days"),"%Y%m%d")
ENDIF
PowerBI:
DateTime.ToText(Date.AddDays(DateTime.FixedLocalNow(),-1), "yyyyMMdd")
Solved! Go to Solution.
if Date.DayOfWeek(DateTime.FixedLocalNow())=1
then
DateTime.ToText(Date.AddDays(DateTime.FixedLocalNow(),-3), "yyyyMMdd")
else
DateTime.ToText(Date.AddDays(DateTime.FixedLocalNow(),-1), "yyyyMMdd")
if Date.DayOfWeek(DateTime.FixedLocalNow())=1
then
DateTime.ToText(Date.AddDays(DateTime.FixedLocalNow(),-3), "yyyyMMdd")
else
DateTime.ToText(Date.AddDays(DateTime.FixedLocalNow(),-1), "yyyyMMdd")
Didn't realize it is that straightforward as I thought IF THEN ELSE is not accepted in advanced editor. The only thing I added below in red to recognize Monday is 1.
if Date.DayOfWeek(DateTime.FixedLocalNow(), Day.Sunday)=1
then
DateTime.ToText(Date.AddDays(DateTime.FixedLocalNow(),-3), "yyyyMMdd")
else
DateTime.ToText(Date.AddDays(DateTime.FixedLocalNow(),-1), "yyyyMMdd")
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 7 | |
| 6 | |
| 6 | |
| 6 |