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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Luca2020
Helper I
Helper I

Adding total sum previous year in a column

Hi, 

I've the following table "PRIMANOTA RIGHE"

 

1.png 

 

 

 

 

 

 

 

 

 

The table shows the accounting journals of several companies and several years. To obtain the monthly balance sheet I created the following measure that returns the cumulative sum from the beginning of the year for each account:

 

IMP_SP = CALCULATE(CALCULATE(TOTALYTD(SUM('PRIMANOTA RIGHE'[Value])*-1; 'DATE'[Date].[Date]); FILTER('PRIMANOTA RIGHE'; NOT 'PRIMANOTA RIGHE'[Registration] IN {"CHPA"}))).

 
For example, the Trade Receivable for the PANT society are 220 (200 +20) in january 2020, in february they become 250 (220 +30)...
 
At the end of each year the accounting officer makes the closing entries (registration = CHPA) that reset all accounts to zero (for this reason I excluded the row that have registration = CHPA in the measure). Then at the beginning of the year the accounting officer makes the opening registrations to return the correct value (for example, the sum of the remaining trade receivables in 2019 amounts to 200 € as reported in the opening registration = APPA). The problem is that in reality the reopening is made around March or April, so until then the measure for the new year is missing the remaining amount from the previous year: 
 
2.png
 
 
 
The measure is incorrect until this registration is made: 
ACCOUNT             TYPE     REGISTRATION        DATE               VALUE
Trade Receivable     P                APPA           01/01/2021              30
 
How can I solve this problem? The correct measure formula requires to add the total sum previous year for each account (trade receivable is just one of many), if in the current year the registration APPA is missing. 
 
Thanks, 
Luca
2 REPLIES 2
amitchandak
Super User
Super User

@Luca2020 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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