Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
talita19ny
Frequent Visitor

Summing only first value across a specific group

Hello, 

 

I'm trying to get a total sum for fees that are paid per user card transaction. However the dataset lists all items per transaction and includes the fee on all lines. The correct calculation for this would be taking only one fee per transaction and not per line. I would then need to add all the fees for the different transactions. transaction. How could I calculate this? The image below highlights  what needs to be added. I hope this makes sense and any help is much appreciated. 

 

Thanks

 

talita19ny_0-1648654376416.png

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @talita19ny 

Try formulas as below:

Measure:

Rank = 
RANKX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Transactions ID] = MAX ( 'Table'[Transactions ID] )
    ),
    CALCULATE ( MAX ( 'Table'[Column3] ) ),
    ,
    ASC
)
New Fee =
IF ( [Rank] = 1, SUM ( 'Table'[Fee] ), BLANK () )

5.png

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @talita19ny 

Try formulas as below:

Measure:

Rank = 
RANKX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Transactions ID] = MAX ( 'Table'[Transactions ID] )
    ),
    CALCULATE ( MAX ( 'Table'[Column3] ) ),
    ,
    ASC
)
New Fee =
IF ( [Rank] = 1, SUM ( 'Table'[Fee] ), BLANK () )

5.png

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@talita19ny , Try a measure like

 

sumx(summarize(Table, Table[Transaction_id],Table [Fee]), [Fee])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.