AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • Rolodex
    • Podcast
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Acumatica Dashboard...
Create Monthly P&L ...
 
Notifications
Clear all

Questions [Solved] Create Monthly P&L Summary for Past 12 Months and Previous 12 Month Periods

 
Acumatica Dashboards
Last Post by Royce Lithgo 3 years ago
6 Posts
3 Users
3 Reactions
4,185 Views
RSS
tiggermbt
Posts: 11
 tiggermbt
Topic starter
August 7, 2019 10:54 pm
(@tiggermbt)
Active Member
Joined: 5 years ago

I am trying to create a Generic Inquiry to accomplish what the title indicates above. It appears that the data needed for this is conveniently located in the GLHistory table. However, I'm running into an intriguing and baffling architecture decision that I cannot figure a method around.

For simplicity, let's assume the GLHistory has the following columns:

  • Branch
  • Sub
  • Account
  • FinPeriodID
  • YtdBalance

There are a few other columns but none that I believe are applicable to my problem. 

Acumatica adds a row for each Branch, Sub, Account, FinPeriodID that has a value for example if I had the following:

  • Branch XYZ
  • Sub 1
  • Account 123
  • FinPeriodIDs - (201901, 201902, 201903)
  • YtdBalance - (10, 20, 30)

I would have the following rows:

Branch -- Sub -- Account -- FinPeriodID -- YtdBalance

XYZ     --  1      -- 123          -- 201901           -- 10

XYZ     --  1      -- 123          -- 201902           -- 20

XYZ     --  1      -- 123          -- 201903           -- 30

That's easy to work with in a Generic Inquiry when totaling multiple accounts together to get high level totals such as revenue, COGS, expenses.

However, Acumatica doesn't write a row if there were no transactions in a month. So if I have account 124 with the following YtdBalance (note that in February there was no change in value):

  • Branch XYZ
  • Sub 1
  • Account 123
  • FinPeriodIDs - (201901, 201902, 201903)
  • YtdBalance - (10, 10, 30)

I would have the following rows:

Branch -- Sub -- Account -- FinPeriodID -- YtdBalance

XYZ     --  1      -- 124          -- 201901           -- 10

XYZ     --  1      -- 124          -- 201903           -- 30

There is no row for February in the data! So when I total up Account 123 and 124 for February I get a total of 20 instead of 30 since there was no value in the data set for February.

I'm assuming I'm not the first person to want a P&L summary nor to run into this issue with what appears to be a very poor database architecture decision by Acumatica. The database space savings of this decision was definitely not worth the performance impact nor the development impact (internally and externally)!

Has anyone dealt with this perviously and can you suggest how you have solved this? Help greatly appreciated! 


Topic Tags
P&L Financial Reports Generic Inquiry
5 Replies
Royce Lithgo
Posts: 557
 Royce Lithgo
August 11, 2019 4:04 pm
(@roycelithgo)
Honorable Member
Joined: 6 years ago

Yes dealt with it many times. You need to use GLHistoryByPeriod as your driving table. You will then need to join GLHistory twice. Give one of the joins the Alias GLHistoryLastActive. So basically what you want to do is select data from GLHistory if the period had a movement. If it didn't have a movement, you take it from GLHistoryLastActive. GLHistoryLastActive joins finPeriodID to lastActivityPeriod on GLHistoryByPeriod. In your results, you need to use IsNull to take data from GLHistoryLastActive if GLHistory is Null (GLHistory is joined to GLHistoryByPeriod on finPeriodID - when there's no movement for a period, null will be returned).

Make sure GLHistoryByPeriod is Left joined to both GLHistory and GLHistoryLastActive.


Reply
Tim Rodman reacted
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
August 31, 2019 10:15 am
(@timrodman)
Famed Member
Joined: 10 years ago

Here's a link to a similar topic:

https://www.augforums.com/augforums/acumatica-generic-inquiries/pulling-revenue-year-to-date-ytd-figures-from-glhistory-for-dashboard-scorecard/


Reply
tiggermbt
Posts: 11
 tiggermbt
Topic starter
September 3, 2019 1:25 pm
(@tiggermbt)
Active Member
Joined: 5 years ago

@royce-lithgo and @timrodman, Thank you both for the information. The information on the GLHistoryLastActive was very useful and will continue to be useful for GIs. That was exactly the piece I was missing. 

This gave me the information to be able to solve it in SQL as well so I could provide a much richer set of data, providing a 12 month historical P&L with analysis as well as various charts and trend lines based on financial data. 

Thank you again for your help!


Reply
Tim Rodman reacted
Royce Lithgo
Posts: 557
 Royce Lithgo
May 25, 2022 6:32 pm
(@roycelithgo)
Honorable Member
Joined: 6 years ago

This problem came up again for me and reading over my previous post was a little unclear. For a concise explanation of GLHistoryByPeriod, check the help:

https://help.acumatica.com/Help?ScreenId=ShowWiki&pageid=0706f316-2b71-6254-44dc-65544025f479

(scroll down a bit to Historical Tables)

 


Reply
Royce Lithgo
Posts: 557
 Royce Lithgo
May 26, 2022 2:49 am
(@roycelithgo)
Honorable Member
Joined: 6 years ago

Note: GLHistoryByPeriod is a very heavy DAC - just look at the Trace from a GI that uses it to see the SQL it generates. So be careful how you use it. In my case where I wanted YTD P&L, it was substantially faster to sum the GLHistory records up to the required period (for the Fin Year of the Period) and calculate the Balance than it was to use LastActivityPeriod from GLHistoryByPeriod to get the YTD Balance from that period. 


Reply
Tim Rodman reacted
Forum Jump:
  Previous Topic
Next Topic  
Related Topics
  • Dashboard Parameters Aren't Filtering Data from Underlying GI
    3 years ago
Topic Tags:  P&L (2) , Financial (2) , Reports (5) , Generic Inquiry (41) ,
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,526 Topics
  • 10.9 K Posts
  • 33 Online
  • 2,338 Members
Our newest member: Shoaib Shafquat
Latest Post: Pick List report suddenly not splitting on Shipment
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

 No online members at the moment

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2025 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×