DAX IF 语句不能使用 Table 列
DAX IF Statement Can't Use Table Column
我有以下 DAX 表达式:
Students_Who_Viewed = var max_report_date = TOPN(1,DISTINCT(table_a_Historical[ReportDate]),table_a_Historical[ReportDate])
var last_week_report_date = max_report_date - 2
/////
var this_week_student_viewed = CALCULATE(
SUM(table_a_Historical[CntViewedByStudent_CY]),
KEEPFILTERS(table_a_Historical[ReportDate] = max_report_date)
)
/////
var last_week_student_viewed = CALCULATE(
SUM(table_a_Historical[CntViewedByStudent_CY]),
KEEPFILTERS(table_a_Historical[ReportDate] = last_week_report_date)
)
/////
var students_viewed_wow_change = COALESCE(this_week_student_viewed,0) - COALESCE(last_week_student_viewed,0)
/////
RETURN
IF (
**table_a_Historical[exempt_status_cy] = "exempt" || table_a_Historical[exempt_status_py],**
"N/A",
IF (
students_viewed_wow_change > 0 //This means views this week is more than last week.
,1
,IF (
students_viewed_wow_change < 0 //This means there were less views this week than last week
,-1
,0 //This value will be used if there is no change in views this week relative to last week.
)
)
)
在**包围的部分,我一直收到错误信息。这些列在 table 中有效。这是为什么?
由于 DAX 搜索聚合,请在下面直接引用列名的地方试试这个:
min(table_a_Historical[exempt_status_cy])
希望这会奏效。
我有以下 DAX 表达式:
Students_Who_Viewed = var max_report_date = TOPN(1,DISTINCT(table_a_Historical[ReportDate]),table_a_Historical[ReportDate])
var last_week_report_date = max_report_date - 2
/////
var this_week_student_viewed = CALCULATE(
SUM(table_a_Historical[CntViewedByStudent_CY]),
KEEPFILTERS(table_a_Historical[ReportDate] = max_report_date)
)
/////
var last_week_student_viewed = CALCULATE(
SUM(table_a_Historical[CntViewedByStudent_CY]),
KEEPFILTERS(table_a_Historical[ReportDate] = last_week_report_date)
)
/////
var students_viewed_wow_change = COALESCE(this_week_student_viewed,0) - COALESCE(last_week_student_viewed,0)
/////
RETURN
IF (
**table_a_Historical[exempt_status_cy] = "exempt" || table_a_Historical[exempt_status_py],**
"N/A",
IF (
students_viewed_wow_change > 0 //This means views this week is more than last week.
,1
,IF (
students_viewed_wow_change < 0 //This means there were less views this week than last week
,-1
,0 //This value will be used if there is no change in views this week relative to last week.
)
)
)
在**包围的部分,我一直收到错误信息。这些列在 table 中有效。这是为什么?
由于 DAX 搜索聚合,请在下面直接引用列名的地方试试这个:
min(table_a_Historical[exempt_status_cy])
希望这会奏效。