Forum Discussion

ahoggatt42's avatar
ahoggatt42
Regular Visitor
2 years ago
Solved

Cumulative Sum from Two Different Tables

My company is currently using two completely seperate systmes to track sales in US vs sales for the rest of the world. Additionally we have two different types of sales, OP and UO orders. I am trying...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ahoggatt42 ,

    1. Create a calculation table and obtain data that meets the conditions.

    Table = 
    UNION(SELECTCOLUMNS(
        FILTER('AR Data','AR Data'[Order Type] = "UO"),
        "MyDate",'AR Data'[Order Date],
        "MyYear",'AR Data'[Order Year],
        "MyMonth",'AR Data'[Order Month],
        "MyPrice",'AR Data'[Sum of True Price]),
        SELECTCOLUMNS(
            FILTER('SO Data','SO Data'[Order Type] = "UO"),
            "MyDate",'SO Data'[Trans Date],
            "MyYear",'SO Data'[Trans Year],
            "MyMonth",'SO Data'[Trans Month],
            "MyPrice",'SO Data'[Sum of True Price]))

     

    2. Create measure.

    Measure =
    CALCULATE(SUM('Table'[MyPrice]),FILTER(ALL('Table'), 'Table'[MyYear] = MAX('Table'[MyYear]) && 'Table'[MyMonth] = MAX('Table' [MyMonth]) &&'Table'[MyDate] <= MAX('Table'[MyDate])))

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Clara Gong

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.