Forum Discussion
rohitkalane
7 years agoFrequent Visitor
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...
- 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.
Greg_Deckler
7 years agoCommunity Champion
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.
rohitkalane
7 years agoFrequent Visitor
Yes, I just removed the All filter function. Everything works perfectly now. Thanks a lot for your help.