Forum Discussion

RD6308's avatar
RD6308
New Member
4 years ago
Solved

Beginner help with finding the difference between two tables

I have two tables:   An annual budget, organized by month and category. Month Category Amount January Hardware Operating Expenses $5,000 February Hardware Operating Expenses $5,00...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi RD6308 ,

    Since you did not give a specific table, I had to create my own table for testing according to your description, please point out if there are any problems.

     

    Please try below steps:

    1.below is my test table 

    Budget: "Index" column are used to sort the "Month" column by this column

    Transcations:

    Model:

    2. create a measure and add it to table visual

    Budget VS Actuals =
    VAR cur_month =
        SELECTEDVALUE ( Budget[Month] )
    VAR cur_budget =
        CALCULATE ( MAX ( Budget[Amount] ), Budget[Month] = cur_month )
    VAR cur_actuals =
        CALCULATE ( MAX ( Transcations[Amount] ), Transcations[Date] = cur_month )
    VAR diff = cur_actuals - cur_budget
    RETURN
        IF ( diff > 0, "+" & diff, "-" & diff )
    

    Please refer attached  .pbix file 

     

    Best regards,
    Community Support Team_ Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.