gpt4 book ai didi

parameter-passing - 将参数传递给 DAX 查询报表生成器

转载 作者:行者123 更新时间:2023-12-02 02:02:34 30 4
gpt4 key购买 nike

我需要一些帮助。下面是我从 Power BI 复制到 Power BI Report Builder 中的 DAX 查询。我希望将参数传递到此查询中以获取“edw dim_paycom_amcs_location_xref”[Paycom_Location_Desc]。但是,我不确定将其放置在查询中的位置。我已经对此进行了研究,无论我尝试将其放在哪里,我都会收到错误。有人能帮忙吗?非常感谢。

      // DAX Query
DEFINE
VAR __DS0FilterTable =
TREATAS({"2021"}, 'edw dimDate'[Year])

VAR __DS0FilterTable2 =
TREATAS({"August"}, 'edw dimDate'[MonthName])

VAR __DS0Core =
SUMMARIZECOLUMNS(
'edw dimDate'[MonthYear],
'edw dimDate'[Month],
'edw dim_paycom_amcs_location_xref'[Paycom_Location_Desc],
__DS0FilterTable,
__DS0FilterTable2,
"SumOvertime_Hours_by_Day", CALCULATE(SUM('PaycomHours'[Overtime_Hours_by_Day])),
"SumReg_Hours_by_Day", CALCULATE(SUM('PaycomHours'[Reg_Hours_by_Day])),
"Transportation", 'PaycomHours'[Transportation],
"Total_Inbound_Tons", 'PaycomHours'[Total Inbound Tons],
"Total_Inbound_Tons__excl_Yakima_", 'PaycomHours'[Total Inbound Tons (excl Yakima)],
"No_Operating_Days", 'edw dimDate'[No.Operating Days],
"Tonnage_Inbound__3rd_Party", 'PaycomHours'[Tonnage Inbound- 3rd Party],
"Tonnage_Inbound__Intercompany", 'PaycomHours'[Tonnage Inbound- Intercompany],
"Tonnage_Inbound___3rd_Party_Metal", 'PaycomHours'[Tonnage Inbound - 3rd Party Metal],
"Tonnage___Intercompany_Metal", 'PaycomHours'[Tonnage - Intercompany Metal],
"Tonnage___Intercompany_Hog_Fuel", 'PaycomHours'[Tonnage - Intercompany Hog Fuel],
"Tonnage___3rd_Party_Hog_Fuel", 'PaycomHours'[Tonnage - 3rd Party Hog Fuel],
"Total_Commodities_Volume_Sold", 'PaycomHours'[Total Commodities Volume Sold],
"Tonnage___Intercompany_Cardboard", 'PaycomHours'[Tonnage - Intercompany Cardboard],
"Tonnage___Intercompany_ALL", 'PaycomHours'[Tonnage - Intercompany ALL],
"Tonnage___3rd_Party_ALL", 'PaycomHours'[Tonnage - 3rd Party ALL]
)

VAR __DS0PrimaryWindowed =
TOPN(
501,
__DS0Core,
'edw dimDate'[Month],
1,
'edw dimDate'[MonthYear],
1,
'edw dim_paycom_amcs_location_xref'[Paycom_Location_Desc],
1
)

EVALUATE
__DS0PrimaryWindowed

ORDER BY
'edw dimDate'[Month],
'edw dimDate'[MonthYear],
'edw dim_paycom_amcs_location_xref'[Paycom_Location_Desc]

最佳答案

我建议如下:

DEFINE
VAR __DS0FilterTable =
TREATAS ( { "2021" }, 'edw dimDate'[Year] )
VAR __DS0FilterTable2 =
TREATAS ( { "August" }, 'edw dimDate'[MonthName] )
VAR __DS0FilterTable3 =
TREATAS ( { @Location }, 'edw dim_paycom_amcs_location_xref'[Paycom_Location_Desc] )
VAR __DS0Core =
SUMMARIZECOLUMNS (
'edw dimDate'[MonthYear],
'edw dimDate'[Month],
'edw dim_paycom_amcs_location_xref'[Paycom_Location_Desc],
__DS0FilterTable,
__DS0FilterTable2,
__DS0FilterTable3,
[... Remainder of query the same ...]

请务必将 @Location 映射到您的报告参数:

Dataset Properties screenshot

关于parameter-passing - 将参数传递给 DAX 查询报表生成器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68820105/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com