如何在 DAX 中使用 TOPNSKIP、DATESBETWEEN 和 FILTERS 编写单个查询?

How to write single query with TOPNSKIP, DATESBETWEEN, and FILTERS in DAX?

在单个查询中执行以下 DAX 函数。

我可以用 FILTER/FILTERS 使用 TOPNSKIP 进行查询,它有效并且 returns 数据

EVALUATE TOPNSKIP
    (10, 10,
            FILTER(Sales,Sales[Name] = "computer")
    ) ORDER BY 'Sales'[PurchasedDate] ASC

它 return Name="computer" 的所有行

但是当尝试执行两个查询时,如果 SKIP 值 0

,第一个是有效的
EVALUATE TOPNSKIP
    (10, 0, SUMMARIZECOLUMNS
            (
                'Sales'[Name],'Sales'[PurchasedDate],DATESBETWEEN ('Sales'[PurchasedDate], DATE(2022, 01, 01) , DATE(2022, 02, 01)),
                 FILTER(Sales,Sales[Name] = "computer")
            )
    ) ORDER BY 'Sales'[PurchasedDate] DESC

2 列 returns 数据

如果skip=10,当我执行下面的查询时,查询执行失败

EVALUATE TOPNSKIP
    (10, 10, SUMMARIZECOLUMNS
            (
                'Sales'[Name],'Sales'[PurchasedDate],DATESBETWEEN ('Sales'[PurchasedDate], DATE(2022, 01, 01) , DATE(2022, 02, 01)),
                 FILTER(Sales,Sales[Name] = "computer")
            )
    ) ORDER BY 'Sales'[PurchasedDate] DESC

错误:TOPNSKIP is not supported with the given parameter combination. Please review MSDN documentation.

问题已通过以下查询得到解决

EVALUATE CALCULATETABLE  
(
        TOPNSKIP( 10, 10, 'Sales', 'Sales'[PurchasedDate], DESC )
        ,FILTER(Sales,Sales[Name] = "Computer")
        ,DATESBETWEEN ('Sales'[PurchasedDate], DATE(2021, 01, 01) , DATE(2022, 01, 31))  
)