cancel
Showing results for 
Search instead for 
Did you mean: 

Ayuda con query de cuentas contables vs presupuesto

0 Kudos
633

Buen día a Todos,

Soy nuevo en el foro y más nuevo en la creación de querys, por eso recurro a ustedes porque tengo problemas con uno,
Manejo Power BI en la empresa y me pidieron un dashboard para indicadores de finanzas, quieren información de las cuentas contables (OACT, OJDT, JDT1) vs su presupuesto (OBGT, BGT1) con el identificador del proyecto (OPRJ, OBGS), el problema está en que lo he armado, pero como no sé muy bien las sentencias para sql, los datos me los da en totales, no sé como poner la sentencia correcta, alguien me puede ayudar???, este es el query que tengo:

SELECT 	
	'BD_2021' as 'Base de datos',
	T7.[PrjName] as 'Proyecto',
	T0.[Acctcode], T0.[AcctName],
	MONTH(T2.[RefDate]) AS 'Mes',
	(T4.[CredSTotal] + (T4.[DebSTotal]*-1)) as 'Presupuesto', 
	(T2.[Credit] + (T2.[Debit]*-1)) as 'Monto'
FROM [BD_2021].[dbo].[OACT] T0	
	INNER JOIN OBGT T3 ON T0.[AcctCode]=T3.[AcctCode]
	INNER JOIN JDT1 T2 ON T0.[AcctCode]=T2.[Account]
	INNER JOIN OJDT T1 ON T2.[TransId]=T1.[TransId]
	LEFT JOIN OPRJ T7 ON T2.[Project]=T7.[PrjCode]
	INNER JOIN BGT1 T4 ON T3.[AbsId]=T4.[BudgId]
	INNER JOIN BGT2 T5 ON T3.[AbsId]=T5.[BudgId]
	INNER JOIN BGT3 T6 ON T3.[AbsId]=T6.[BudgId]
	LEFT JOIN OBGS T8 ON T4.[Instance]=T8.[BaseId]
WHERE T2.[RefDate] BETWEEN '20210101' AND '20211231' AND T3.[FinancYear] = '20210101'
GROUP BY T0.[Acctcode], T0.[AcctName], T2.[RefDate], T7.[PrjName], T4.[DebSTotal], T4.[CredSTotal], T2.[Credit], T2.[Debit]
ORDER BY T0.[Acctcode]
former_member751964
Participant
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with Community Q&A, as the overview provides tips for preparing questions that draw responses from our members.

For example, you can:

- outline what steps you took to find answers (and why they weren't helpful)

- share screenshots of what you've seen/done

- make sure you've applied the appropriate tags

- use a more descriptive subject line.

The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&A tutorial Q&A tutorial

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a Picture to your profile you encourage readers to respond.

Additionally, if you would like to reach a larger audience, I recommend you add a translated version of your content in English at the bottom of your content.

0 Kudos

Buen día.

Tengo el mismo problema que tu.

¿Pudite encontrar el query? y de ser así, ¿cuál es el query que lograste hacer?

moshenaveh
Community Manager
Community Manager
0 Kudos
Hello, While we're happy that you've come to SAP Community to get an answer to your question -- posting in older threads is not the best way to get guidance.
If you're looking for help, you should ask a new question: https://answers.sap.com/questions/ask.html.
Here are some tips to help you craft an effective question for our community: https://community.sap.com/resources/questions-and-answers, https://developers.sap.com/tutorials/community-qa.html, https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a....
I encourage you to follow this guidance, as I'd really like to see you get a solution to your problem.
I hope you find this advice useful!

Accepted Solutions (0)

Answers (0)