我有这种格式的SSAS表格模型:
我需要一个SSAS DAX查询,它输出以下格式:
有谁知道如何做到这一点?
我将在SSRS报告中使用它。
答案 0 :(得分:0)
很难给出答案,你可以复制/粘贴,因为我不知道你的模型或表格是什么样的。您应该能够调整下面的度量和查询以适合您的模型。
[ProductSales] :=
SUMX ( Sales, Sales[Quantity] * Sales[Price] )
[SalesMTD] :=
CALCULATE ( [ProductSales], DATESMTD ( DateTable[DateKey] ) )
[SalesYTD] :=
CALCULATE ( [ProductSales], DATESYTD ( DateTable[DateKey] ) )
[SalesMTDPrevYear] :=
CALCULATE (
[ProductSales],
SAMEPERIODLASTYEAR ( DATESMTD ( DateTable[DateKey] ) )
)
[SalesYTDPrevYear] :=
CALCULATE (
[ProductSales],
SAMEPERIODLASTYEAR ( DATESYTD ( DateTable[DateKey] ) )
)
将您的信息提取到SSRS(我假设您知道如何进入数据集创建屏幕):
EVALUATE
SUMMARIZE (
Locations[Continent],
Locations[Country],
Locations[City],
Products[ProductName],
"Month Sales (This Year)", [SalesMTD],
"Month Sales (Last year)", [SalesMTDPrevYear],
"YTD Sales (This Year)", [SalesYTD],
"YTD Sales (Last year)", [SalesYTDPrevYear]
)