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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
eryka_90
Helper I
Helper I

Sum Unique value based on date and week

Hello Community,

 

How to have sum of amount by Unique ID considering max load date for particular load week.

Example as below

 

ID No  Load DateLoad Week Amount
1234 30/10/2023 44 3,500 
1234 04/11/2023 44 3,500 
5678 24/10/2023 43 2,300 
3451 30/10/2023 44 4,000
123425/9/2023423,500 

 

The chart should display Total amount Week 44 = 7,500 Week 43 = 2,300 and Week 42 = 3,500.

I use below formula but for Week 44 its sum as 11,000
 
TotalAmount = SUMX(DISTINCT('Pending Items'[CORA ID]),CALCULATE(SUM('Pending Items'[Invoice Amount (USD)])))
 
Thank in advance for your help!
2 REPLIES 2
Anonymous
Not applicable

@eryka_90  Does this work for you?

TotalAmountByLoadWeek =
CALCULATE (
    SUM ( 'Sheet1'[Amount] ),
    FILTER (
        Sheet1,
        'Sheet1'[Load Date]
            = CALCULATE (
                MAX ( 'Sheet1'[Load Date] ),
                ALLEXCEPT ( 'Sheet1', 'Sheet1'[Load Week] )
            )
    )
)

bchager6_1-1705326662125.png

 



Hi @Anonymous ,

 

The formula given has weird value :

eryka_90_0-1705371948909.png

As my previous formula TotalAmount = SUMX(DISTINCT('Pending Items'[CORA ID]),CALCULATE(SUM('Pending Items'[Invoice Amount (USD)]))), its give right value but only for week which have duplicate data will calculate sum too. For week 44, its should display 1,586.

 

eryka_90_1-1705372076483.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.