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

Community site session details

Session Id :

SQL View to Return Budget Amounts by Accounting Period in Microsoft Dynamics 365 Business Central

Ian Grieve Profile Picture Ian Grieve 22,784
Microsoft Dynamics 365 Business CentralI posted a SQL view towards the end of January which returns the start and end date of accounting periods in Microsoft Dynamics 365 Business Central.

The SQL view below uses that view to return the budget figures from Dynamics BC for each accounting period grouped by account and the global and budget dimensions.

-- drop view if it exists
IF OBJECT_ID(N'uv_AZRCRV_BudgetAmountByAccountingPeriod', N'V') IS NOT NULL
	DROP VIEW uv_AZRCRV_BudgetAmountByAccountingPeriod
GO -- create view CREATE VIEW uv_AZRCRV_BudgetAmountByAccountingPeriod AS /*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
SELECT ['G/L Budget Entry'].[Budget Name] ,['G/L Budget Entry'].[G_L Account No_] ,[Accounting Periods].[Starting Date] ,[Accounting Periods].[Ending Date] ,[Accounting Periods].[Name] ,['G/L Budget Entry'].[Global Dimension 1 Code] ,['G/L Budget Entry'].[Global Dimension 2 Code] ,['G/L Budget Entry'].[Budget Dimension 1 Code] ,['G/L Budget Entry'].[Budget Dimension 2 Code] ,['G/L Budget Entry'].[Budget Dimension 3 Code] ,['G/L Budget Entry'].[Budget Dimension 4 Code] ,SUM(['G/L Budget Entry'].Amount) AS [Budget Amount] FROM [CRONUS UK Ltd_$G_L Budget Entry$437dbf0e-84ff-417a-965d-ed2bb9650972] AS ['G/L Budget Entry'] INNER JOIN uv_AZRCRV_GetAccountingPeriodDates AS [Accounting Periods] ON ['G/L Budget Entry'].[Date] BETWEEN [Accounting Periods].[Starting Date] AND [Accounting Periods].[Ending Date] GROUP BY ['G/L Budget Entry'].[Budget Name] ,['G/L Budget Entry'].[G_L Account No_] ,[Accounting Periods].[Starting Date] ,[Accounting Periods].[Ending Date] ,[Accounting Periods].[Name] ,['G/L Budget Entry'].[Global Dimension 1 Code] ,['G/L Budget Entry'].[Global Dimension 2 Code] ,['G/L Budget Entry'].[Budget Dimension 1 Code] ,['G/L Budget Entry'].[Budget Dimension 2 Code] ,['G/L Budget Entry'].[Budget Dimension 3 Code] ,['G/L Budget Entry'].[Budget Dimension 4 Code] ORDER BY [Accounting Periods].[Starting Date] GO GRANT SELECT ON uv_AZRCRV_BudgetAmountByAccountingPeriod TO [Reporting Users] GO

Read original post SQL View to Return Budget Amounts by Accounting Period in Microsoft Dynamics 365 Business Central at azurecurve|Ramblings of an IT Professional


This was originally posted here.

Comments

*This post is locked for comments