【问题标题】:Is there a dax Function that support paging in query?是否有支持查询分页的 dax 函数?
【发布时间】:2019-09-11 09:33:26
【问题描述】:

我编写了一个 DAX 查询,其中包含 SSAS 表格模型中的一些不同类型的度量。现在我必须在某些页面中打破我的解决方案,以便在应用程序中使用并按我的度量进行排序。

我使用了 TOPNSKIP() 函数,但无法创建按度量排序的表。

DAX 代码:

EVALUATE 
SELECTCOLUMNS(
      TopnSkip ( 5,0,'Station',Station[StationTitle],asc),
        "NameOfStation",Station[StationTitle],
        "TradeSellPrice", [TradeSellPrice],
        "TradePrice" ,[TradePrice],
        BrokerCommission",[BrokerCommission])
    Order by [TradePrice] asc

此代码首先从“Station”表中选择Top 5,然后按“Tradeprice”排序。这不是我的期望,我需要一个按“TradePrice”排序的解决方案。

【问题讨论】:

    标签: ssas dax ssas-tabular


    【解决方案1】:
    EVALUATE
    TOPNSKIP (
      5, 0,
      SELECTCOLUMNS (
        'Station',
        "NameOfStation", 'Station'[StationTitle],
        "TradeSellPrice", [TradeSellPrice],
        "TradePrice", [TradePrice],
        "BrokerCommission", [BrokerCommission]
      ),
      [TradePrice],
      ASC
    )
    ORDER BY [TradePrice] ASC
    

    SELECTCOLUMNS 的第一个参数是一个表。您将表 TOPNSKIP ( 5, 0, 'Station', 'Station'[StationTitle], ASC ) 传递给它,这是前五个 StationTitles 的 5 行表。

    然后,您定义了要从该 5 行表中选择的列。最后,您按 [TradePrice] 订购了该表的输出。

    TOPNSKIP 将表格作为输入。因此,将包含您需要定义的列的表传递给它,并按其中任何一个进行排序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-01
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      • 2021-01-06
      相关资源
      最近更新 更多