Forum Discussion

Molin's avatar
Molin
Icon for Helper I rankHelper I
1 year ago
Solved

Creating unique table without duplicate values

Dear community,  I am trying to create a calculated table using DAX to list the unique [Reference] times for each transaction. However, some transactions have more than one [reference] time and I ...
  • v-veshwara-msft's avatar
    1 year ago

    Hi Molin ,

    Thanks for reaching out to Microsoft Fabric Community.

    I reviewed your scenario and tried to reproduce it using a small sample dataset with similar structure.
    With the below sample data:

     

    Calculated Table:

    PU_Times = 
    ADDCOLUMNS (
        SUMMARIZE (
            FILTER (
                'TransactionDetails',
                'TransactionDetails'[ObjectNumber] = 999000009
            ),
            'TransactionDetails'[GuestCheckId]
        ),
        "Latest_Reference",
        VAR curCheckId = 'TransactionDetails'[GuestCheckId]
        RETURN
            CALCULATE (
                MAX ( 'TransactionDetails'[Reference] ),
                FILTER (
                    'TransactionDetails',
                    'TransactionDetails'[GuestCheckId] = curCheckId &&
                    'TransactionDetails'[ObjectNumber] = 999000009
                ),
                TOPN (
                    1,
                    FILTER (
                        'TransactionDetails',
                        'TransactionDetails'[GuestCheckId] = curCheckId &&
                        'TransactionDetails'[ObjectNumber] = 999000009
                    ),
                    'TransactionDetails'[PostingTime],
                    DESC
                )
            )
    )
    

     

    The output was:

     

    Let me know if this meets your requirement. If not, feel free to share a small sample of your dataset or a PBIX file (with any sensitive data removed), and I’ll be glad to take a closer look.

    Please consider marking this as the accepted solution if it helps, to assist others facing a similar issue.

    Thnak you.

    Please find the attached .pbix for reference.