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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.