如果电源查询中的语句

发布于 2025-02-09 17:27:59 字数 336 浏览 1 评论 0原文

我有一个简单的IF Power查询语句,我觉得我需要单独的眼睛。

我想说的是,如果本周的当天是星期一,那么我希望该系统在3天前显示任何日期,否则任何其他一天都会显示昨天的日期。我下面的公式正在收到“令牌右par的预期”错误。在第二行的“然后”之后的“日期”。

 if(Date.DayOfWeek(DateTime.FixedLocalNow()) = 0 then
 Date.AddDays(Date.From(DateTime.FixedLocalNow()),-3) else
 Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1))

I have a simple if Statement in Power Query I feel I need a separate set of eyes on.

I am trying to say if the current day of the week is Monday then I want the system to display whatever the date was 3 days ago, else any other day just show yesterdays date. My formula below is receiving the error "Token RightParen expected." at the "Date" after "then" on the 2nd line.

 if(Date.DayOfWeek(DateTime.FixedLocalNow()) = 0 then
 Date.AddDays(Date.From(DateTime.FixedLocalNow()),-3) else
 Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寒江雪… 2025-02-16 17:28:00

一些额外的字符。删除第一个和最后一个括号

let Source =  if 
Date.DayOfWeek(DateTime.FixedLocalNow()) = 0 then
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-3) else
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1)
in Source

A few extra characters. Remove first and last parenthesis

let Source =  if 
Date.DayOfWeek(DateTime.FixedLocalNow()) = 0 then
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-3) else
Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1)
in Source
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文