英文:
what is wrong with DAX measure when trying to reference a calendar table
问题
我有一个名为“Date”的日历表,其中包含过去3年每一天的不同日期。
我还有一个名为“Treatments”的表,其中包含SessionID、Treatment Date和Treatment Status,看起来像这样。
我正在尝试在日历表(该表名为Date)中添加一个新列,该列计算过去30天每天的“Completed” Treatments数量。
我有以下DAX Measure
Completed Treatments =
CALCULATE(
COUNTROWS(Treatments),
Treatments[Treatment Status] = "Completed",
DATESBETWEEN(
Treatments[Treatment Date],
MAX(Date[Date]) - 30,
MAX(Date[Date])))
但我一直收到“[Date]”的语法错误。有人知道发生了什么吗?
英文:
I've got a calendar table called "Date", which contains a distinct date for every day of the the past 3 years.
I also got a "Treatments" table, which contains a SessionID, Treatment Date and a Treatment Status, it looks something like this.
What I am trying to do, is add a new column in the Calendar table (This table is called Date) that counts the amount of "Completed" Treatments for each day for the past 30 days.
I've got the following DAX Measure
Completed Treatments =
CALCULATE(
COUNTROWS(Treatments),
Treatments[Treatment Status] = "Completed",
DATESBETWEEN(
Treatments[Treatment Date],
MAX(Date[Date]) - 30,
MAX(Date[Date])))
but I keep getting an error of "The syntax for '[Date]' is incorrect.
Does anybody know what is going on?
答案1
得分: 1
只需为日期表添加 '。
Completed Treatments =
CALCULATE(
COUNTROWS(Treatments),
Treatments[Treatment Status] = "Completed",
DATESBETWEEN(
Treatments[Treatment Date],
MAX('Date'[Date]) - 30,
MAX('Date'[Date])))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论