如何使用DAX在Power BI中执行SQL Windows功能

时间:2019-11-23 00:20:54

标签: sql dax

请问,我如何在DAX中编写下面的代码,以获取4个列,它们代表唯一ID的先前textvalue?我将不胜感激

SELECT DISTINCT 
[UniqueIdentifier] [Prior 2] = LAG([TextColumn], 2) OVER (PARTITION BY [UniqueIdentifier] ORDER BY [NumberIndex])
    , [Prior 1] = LAG([TextColumn], 1) OVER (PARTITION BY [UniqueIdentifier] ORDER BY [NumberIndex])
    , [Next1] = LEAD([TextColumn], 1) OVER (PARTITION BY [UniqueIdentifier] ORDER BY [NumberIndex])
    , [Next2] = LEAD([TextColumn], 2) OVER (PARTITION BY [UniqueIdentifier] ORDER BY [NumberIndex])

0 个答案:

没有答案