Forum Discussion

bstark1287's avatar
bstark1287
Helper II
3 years ago
Solved

Sum dollar value by open orders

I need help with some DAX. I have a working DAX that counts open orders. I am wanting to adjust this DAX to calculate total sales for open orders. I am not sure why it won't calculate. Here is the wo...
  • jdbuchanan71's avatar
    3 years ago

    bstark1287 

    Reading the code, it looks like you are picking the date and wanting to sum the 'OB Raw Order Data'[ACT_MATERIAL_COST] where the 'OB Raw Order Data'[CREATE_DATE] is on or before the date and the 'OB Raw Order Data'[Order Closed Date] is > the 'tbl_Calendar'[End Of Month] or it is blank.  

    Give this measure a try and see if it is what you are looking for.

    OB USB =
    VAR _Date = MIN ( 'tbl_Calendar'[Date] )
    VAR _EoM = MIN ( 'tbl_Calendar'[End Of Month] )
    RETURN
        CALCULATE (
            SUM ( 'OB Raw Order Data'[ACT_MATERIAL_COST] ),
            'OB Raw Order Data'[CREATE_DATE] <= _Date,
            ( 'OB Raw Order Data'[Order Closed Date] > _EoM || ISBLANK ( 'OB Raw Order Data'[Order Closed Date] ) )
        )