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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
fazza1991
Helper II
Helper II

Sum not adding up correctly

Hi,

I am trying to correct the formula below

 

 

 

 

Measure 3 = 

CALCULATE([Measure 4],  
   DATESINPERIOD ( 
        'Date'[Date],                 
        EOMONTH ( MAX ( 'Terminated|SF'[Notice_Date] ), 0 ), 
        -12,  MONTH))

 

 

 

 

I am trying to get the last 12 months revenue from date of termination but the information is stored on different tables.

 

 Table 1: contain revenue per month

Report MonthAccount IdAccount NameRevenue
01/12/202022 ltd10
01/01/202111 ltd10
01/02/202111 ltd10
01/03/202111 ltd10

 

 

 

 

 


Table 2: contain date client terminated

Notice dateAccount IdAccount NameReason Left
01/03/202111 ltdCompetitor

 

 

 

Table 3: Desired Results

Account NameLast 12 months RevenueReason left
1 ltd30Competitor

 

The above formula allows me to calculate the last 12 months revenue, when slicer is used to show the month reporting on it displays the correct client and revenue but the total includes all clients that may have terminated and the prior 12 months

revenue eg.

 

 

 

Table 4: unwanted results

Account NameLast 12 months revenueReason Left
1 ltd30competitor
Total40 

 

 

 

 

I have also a calendar table linked to Report MOnth and Notice date

 

Thanks in advance

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @fazza1991 ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

(2) We can create  a measure.

Last 12 months Revenue = 
CALCULATE (
    SUM ( 'Table 1'[Revenue] ),
    FILTER (
        'Table 1',
        [Report Month] >= EOMONTH ( MAX ( 'Table 2'[Notice date] ), -12 )
            && [Report Month] <= MAX ( 'Table 2'[Notice date] )
    )
)

(3)Then the result is as follows.

vtangjiemsft_0-1667209745771.png

 

Best Regards,

Neeko Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @fazza1991 ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

(2) We can create  a measure.

Last 12 months Revenue = 
CALCULATE (
    SUM ( 'Table 1'[Revenue] ),
    FILTER (
        'Table 1',
        [Report Month] >= EOMONTH ( MAX ( 'Table 2'[Notice date] ), -12 )
            && [Report Month] <= MAX ( 'Table 2'[Notice date] )
    )
)

(3)Then the result is as follows.

vtangjiemsft_0-1667209745771.png

 

Best Regards,

Neeko Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.