Forum Discussion

jay_patel's avatar
jay_patel
Icon for Helper IV rankHelper IV
4 years ago
Solved

Calculate sales based on selected date

Hi all, I am stucked while calculating sales with different conditions. Let me explain in detail I have a calendar table and a Sales table, and looking for a dax where if i am selecting any dat...
  • amitchandak's avatar
    4 years ago

    jay_patel , Try a measure like

     


    Measure =
    var _max = maxx(allselected('Date1'),'Date1'[Date])
    var _m = Calculate(sum(Table[Value]), filter(Table, Table[Posting Date] >=_max && Table[Cleaning Date] <=_max && [Condition type] = "BSAD"))
    return
    if(isblank(sum(Table[Value])), _m, sum(Table[Value]))

     

     

    or

     

     

     

    If date tble is joined
    Measure =
    var _max = maxx(allselected('Date1'),'Date1'[Date])
    var _m = Calculate(sum(Table[Value]), filter(all(Table), Table[Posting Date] >=_max && Table[Cleaning Date] <=_max && [Condition type] = "BSAD"))
    return
    if(isblank(sum(Table[Value])), _m, sum(Table[Value]))