Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Buget vs Actual on one single table

I have the following transactions table:

 

CCostAccountDateBudgetActualDescription
112019010110010Gas
112019010210050Salary
112019020120050Gas
1120190202200150Salary
112019020320010Gas

 

CCenter is the Cost Center, Account is the bank account, date is the date of the transaction, budget is the budget for that Account, for that Cost Cost, for that specific year-month. The Actual column is the value of the transaction and Description is the description of the transcation. So for example, in January 2019 the company spent 60 dollars on salary and gas. And the budget was 100 - not 200. And in February 2019, 210 dollars was spent and the budget was 200. 

 

I want to create a matrix, tha display the right budget values, but it sums all the values - January 200, and Februaray 600 dollars.

 

 

 

How can I do that, using Dax or Power Query  and preferably , not creating a new table. 

10 Replies

  • Hi Anonymous,

     

    Did you try in the case of the budget the average function, because it seems the budget amount is repeated...

     

    Let us know

     

    Ninter

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Interkoubess, using the average only works if the the matrix is on the last drill level. Look the example:

       

       

      The right budget is 300 not 160. How can I do that?

       

       

       

       

       

      • Interkoubess's avatar
        Interkoubess
        Icon for Solution Sage rankSolution Sage

        Hi Anonymous,

         

        How  the budget is populating?

         

        Could you please check this column formula based on the first date ( I don't know how the budget is populating),

        Budget_modified = IF(DAY('Table 0'[Date])=1,'Table 0'[Budget],0)

        In summary I make the budget equals to zero but the first day of the month.

         

        Let me know if it does not work.....

         

        Ninter

  • avknishokpbi's avatar
    avknishokpbi
    Frequent Visitor

     

     

    Try this dax measure

     

    totalbudget =
    Var budgetbymaxdate = CALCULATE(sum(Table1[Budget]),FILTER(Table1,Table1[Date]=ENDOFMONTH(Table1[Date])))
    Return
    budgetbymaxdate

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      avknishokpbi,

       

      It worked, but sorry, I thought it was not relevant, but I am using a date table to filter the sales table.

       

      CalendarTable                                       Sales

      Date      <----------------------------->  Date

      Month                                                    CCenter

      Day                                                         Account

      Year                                                        Budget

                                                                     Actual

                                                                     Description

       

      So using the measure that you said does not works when I use slicers with CalendarTable's columns.

      • avknishokpbi's avatar
        avknishokpbi
        Frequent Visitor

        Anonymous

         

        Try this DAX

         

        TotalbudgetbyMonth =
        var maxvalue = SUMX(SUMMARIZE(DateTable,DateTable[Month],"amt",MIN(Table1[Budget])),[amt])
        return
        maxvalue