Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Sum BudgetTransactionLine.TransactionCurrencyAmount

$
0
0

I'm trying to get sum of budget transaction line by month. I want to calculate amount for each month.Is there an error on my Query.

The result of my query is :

RECIDLine   RecIDHeader Date                      Amount
5637157326  5637149076  2012-08-01 00:00:00.000   850.00
5637157342  5637149079  2012-12-01 00:00:00.000   1000.00
5637157343  5637149079  2012-12-01 00:00:00.000   80.00
5637157344  5637149079  2012-12-01 00:00:00.000   2700.00

But i want to get somthing like this :

    RECIDLine  RecIDHeader Date                      Amount
    5637157326  5637149076  2012-08-01 00:00:00.000   850.00
    5637157342  5637149079  2012-12-01 00:00:00.000   3780.00

This is my query :
IF OBJECT_ID('tempdb..#BudgetTransTmp') IS NOT NULL
        DROP TABLE #BudgetTransTmp
    Select  
            BudgetTransactionLine.RECID  AS RecIdLine,
            BUDGETTRANSACTIONHEADER.RECID   AS RecIdHeader,
            BudgetTransactionLine.DATE,
            SUM(CAST((BudgetTransactionLine.TransactionCurrencyAmount )  as decimal(18,2))) AS Amount
    INTO   #BudgetTransTmp 
    FROM   MicrosoftDynamicsAX.dbo.BudgetTransactionLine  AS BudgetTransactionLine

          INNER JOIN MicrosoftDynamicsAX.dbo.BUDGETTRANSACTIONHEADER AS BUDGETTRANSACTIONHEADER
            ON  BUDGETTRANSACTIONHEADER.RECID =  BudgetTransactionLine.BUDGETTRANSACTIONHEADER
            AND BUDGETTRANSACTIONHEADER.budgetTransactionType  =  '3'
            AND BUDGETTRANSACTIONHEADER.PARTITION  =  @Partition

    WHERE   BudgetTransactionLine.PARTITION  =@Partition
            AND BudgetTransactionCode.DATAAREAID = 'USMF'  
            AND  BudgetTransactionLine.DATE >= PeriodCalandarTmp.StartDate
            AND  BudgetTransactionLine.DATE <= PeriodCalandarTmp.EndDate


    GROUP BY    BudgetTransactionLine.DATE,
                BUDGETTRANSACTIONHEADER.RECID,
                BudgetTransactionLine.RECID  
AND I NEED TO KEEP BudgetTransactionLine.RECID IN THE SELECT STATMENT



Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>