Forum Discussion

tecumseh's avatar
tecumseh
Icon for Resolver III rankResolver III
3 years ago
Solved

OFFSET's Relation parameter may have duplicate rows. This is not allowed.

Hi all, I am trying to partition and sort my calculated table by Customer Group ID and Date. However OFFSET is stating that I may have duplicate rows in the source table. I checked the source tabl...
  • parry2k's avatar
    3 years ago

    tecumseh try this:

     

    Try_2 = 
    VAR T10 = 
    SELECTCOLUMNS(
    Try_1,
    "Customer Group ID", Try_1[Customer Group ID],
    "Begin Quarter Date", Try_1[Begin Quarter Date],
    "Revenue", Try_1[Revenue]
    )
    VAR T20 = 
    ADDCOLUMNS(
    T10,
    "Previous Qtr Date",
    SELECTCOLUMNS(
    OFFSET(
    -1,
    T10,
    ORDERBY([Begin Quarter Date]),
    PARTITIONBY([Customer Group ID])
    MATCHBY([Begin Quarter Date])
    ),
    [Begin Quarter Date]
    )
    )
    
    RETURN
    T2

     

    👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo