I want to request your help and suggestions on the customization of creating a data entity to display data shown in the Actual vs budget form.
I need to create a data entity for the user to export. The data entity is expected to contain all 7 fields shown in the Actual vs Budget form. The data entity also requires one extra field, which is the BudgetModelId.
Through my study, I find out that the ledger dimension used to get the revised budget and actual amount are different. The ledger dimension used for budget is stored in DimensionAttributeValueCombination where its LedgerDimensionType is 2, while ledger dimension used for actual amount is stored in DimensionAttributeValueCombination table where the LedgerDimensionType is 0 and the account structure is equal to 0.
Therefore, I cannot find the common key that allow me to join table and return the same record as in Actual vs budget form.
SELECT SUM(T1.ACCOUNTINGCURRENCYAMOUNT) AS REVISEDBUDGET
, T1.BUDGETTYPE AS AMOUNTTYPE
, T1.LEDGERDIMENSION AS LEDGERDIMENSION
, T1.PARTITION AS PARTITION
, 1010 AS RECID
, T2.DISPLAYVALUE AS DISPLAYVALUE
, T2.PARTITION AS PARTITION#2
, T3.BUDGETMODELID AS BUDGETMODELID
, T3.PARTITION AS PARTITION#3
FROM BUDGETTRANSACTIONLINE T1
CROSS JOIN DIMENSIONATTRIBUTEVALUECOMBINATION T2
CROSS JOIN BUDGETTRANSACTIONHEADER T3
WHERE((( T2.LEDGERDIMENSIONTYPE = 2)
AND (( T1.LEDGERDIMENSION = T2.RECID)
AND ( T1.PARTITION = T2.PARTITION)))
AND (( T1.BUDGETTRANSACTIONHEADER = T3.RECID)
AND ( T1.PARTITION = T3.PARTITION)))
GROUP BY T1.LEDGERDIMENSION, T1.BUDGETTYPE, T1.PARTITION, T2.DISPLAYVALUE, T2.PARTITION, T3.BUDGETMODELID, T3.PARTITION
Then, to get the actual amount, I created a view that join two tables below
- DimensionFocusBalance
- DimensionAttributeValueCombination
With the follow view script:
SELECT T1.ACCOUNTINGDATE AS ACCOUNTINGDATE
, T1.DEBITACCOUNTINGCURRENCYAMOUNT AS DEBITACCOUNTINGCURRENCYAMOUNT
, T1.FOCUSLEDGERDIMENSION AS FOCUSLEDGERDIMENSION
, T1.PARTITION AS PARTITION
, 1010 AS RECID
, T2.DISPLAYVALUE AS DISPLAYVALUE
, T2.PARTITION AS PARTITION#2
, (CAST (((SUM(T1.CREDITACCOUNTINGCURRENCYAMOUNT)) + (DebitAccountingCurrencyAmount)) AS NUMERIC(32, 16))) AS ACTUALAMOUNT
FROM DIMENSIONFOCUSBALANCE T1
CROSS JOIN DIMENSIONATTRIBUTEVALUECOMBINATION T2
WHERE((( T1.POSTINGLAYER = 0) AND ( T1.FISCALCALENDARPERIODTYPE = 1))
AND (( T1.FOCUSLEDGERDIMENSION = T2.RECID) AND ( T1.PARTITION = T2.PARTITION)))
GROUP BY T1.ACCOUNTINGDATE, T1.DEBITACCOUNTINGCURRENCYAMOUNT, T1.FOCUSLEDGERDIMENSION, T1.PARTITION, T2.DISPLAYVALUE, T2.PARTITION
When I joined these two view based on the display value, there are null values in the actual amount. If I use outer join, and it becomes left outer join in SQL, it will only return the record if there is a record in the first view, which is the view to get revised budget.
I would like to ask what I can do in order to get the same output as in Actual vs budget form, which is the record still show up even the dimension value contains actual amount, but doesn't have budget.