Forum Discussion

AAMW01's avatar
AAMW01
Icon for Helper I rankHelper I
5 years ago
Solved

DAX Getting running total from Active orders

I have an example table below,   OrderNumber Ref DateOrdered DateOrderDue Price x Quantity 1 AP1 03/07/2021 01/09/2021 1200 2 AP2 04/07/2021 08/07/2021 90 3 AP3 10/07/2021...
  • AAMW01's avatar
    AAMW01
    5 years ago

    Thank you for the references,

     

    I created a query which does what I wanted and I will post it here incase someone has a similar issue.

     

    Running Total MEASURE 1 = 
    CALCULATE (
        SUM ( Sheet1[Price x Quantity] ),
        FILTER (
            ALL ( 'Calendar Table' ),
           'Calendar Table'[Date] <= MAX ( 'Calendar Table'[Date] )
        )
    ) - 
    CALCULATE(
        SUM( Sheet1[Price x Quantity]),
        FILTER (
            ALL ( Sheet1 ),
           Sheet1[DateOrderDue] <= MAX ( 'Calendar Table'[Date] )
        )
    )

    I created a link between my order date in my order book table & calendar table.

    I then created a formula to get the cumulative total of all orders added onto the system.

    I then created a formulat to subtract the date order due transactions against the calendar date.