Forum Discussion

rohitkalane's avatar
rohitkalane
Frequent Visitor
7 years ago
Solved

Days Remaining Calculation

Hello,   I am fairly new to DAX functions and i am trying to calculate a measure which gives me the number of working days remaining for a particular month or upto a particular date. All days excep...
  • Greg_Deckler's avatar
    Greg_Deckler
    7 years ago

    Oh, that is because of the ALL in that formula. You might try changing that to ALLSELECTED and that might resolve it.

     

    Measure 6 = 
    VAR __today = TODAY()
    VAR __max = MAX('Table14'[Schedule Date])
    VAR __total = SUMX(ALLSELECTED(Table14),Table14[New Qty])
    VAR __workdays = SUMX(FILTER(ALL('Calendar'),[Date]>=__today && [Date]<=__max),[IsWorkDay])
    RETURN DIVIDE(__total,__workdays,0)

    Or, you may have to use ALLEXCEPT. Or, you may just use SUMX(Table14,Table14[New Qty]) will depend on exactly what you are trying to do.