web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

totalcostamount sum calculation oddities

(0) ShareShare
ReportReport
Posted on by 1,271

Hello,

There is a standard from in the system called  "Posted project transactions" - projProjectTransactionsListPage. I open it upon my project. The final query before form opens looks like that

SELECT FIRSTFAST FORUPDATE * FROM ProjPostTransView(ProjPostTransView_1) 
	ORDER BY ProjPostTransView.TransDate ASC 
		WHERE ((TransDate>={ts '2003-11-12 00:00:00.000'})) AND ((ProjId = N'0151328')) 
	JOIN FORUPDATE * FROM ProjTable(ProjTable_1) 
		ON ProjPostTransView.ProjId = ProjTable.ProjId 
	NOTEXISTS JOIN FORUPDATE * FROM ProjPostTransSaleView(ProjPostTransSaleView_Invoiced) 
		WHERE ProjPostTransView.TransId = ProjPostTransSaleView.TransId AND ((TransStatus = 1)) 
	NOTEXISTS JOIN FORUPDATE 'x' FROM ProjOnAccTransView(ProjOnAccTransView) 
		WHERE ProjPostTransView.TransId = ProjOnAccTransView.TransId AND ((TransactionOrigin = 22)) AND ((PSAIsOnAccount = 1)) 
	OUTER JOIN FORUPDATE * FROM ResourceView(ResourceView) 
		ON ProjPostTransView.Resource = ResourceView.RecId 
	OUTER JOIN FORUPDATE * FROM smmActivities(smmActivities) 
		ON ProjPostTransView.ActivityNumber = smmActivities.ActivityNumber AND ProjPostTransView.dataAreaId = smmActivities.dataAreaId 
	EXISTS JOIN FORUPDATE * FROM ProjTable(ProjTable_2) 
		WHERE ProjPostTransView.ProjId = ProjTable.ProjId}

sum of the TOTALCOSTAMOUNTCUR field on the form is 9423.00 but if i do this in sql studio using T-SQL I get this for the same project

pastedimage1670849262520v1.png

two values are not the same. I have no idea why. the number of records is 40 on form and in sql query i do for this project. There are 40 records in table ProjPostedTransTable for my project. 

I looked through the standard code thinking that maybe to TOTALCOSTAMOUNTCUR is added some value but I haven't found anything and it doesn't make any sense.

Looking at Form query object there are should be the same values for TOTALCOSTAMOUNTCUR field and therefore the sum of them should be the same as in sql query. There is no need to repeat the whole query because projtable is joined by inner join and this is the main thing for me. other datasources are added by not exists or outer join. not exists can reduce the number of records what doesn't happen. in both cases there 40 records. outer join doesn't affect the number of records from root datasource as well.

Any help would be appreciated

Thank you.

I have the same question (0)
  • Deepak Agarwal Profile Picture
    9,039 on at

    have you tried to add filter on legal entity in SQL query on view.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 628 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 612

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 589 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans