Forum Discussion
Anonymous
4 years agoNot applicable
Previous working day Total
I am trying to get a total for the previous working day total in my model My data is structured as below PO No Purch Date Quantity 100008 30-Sep-21 40 100010 1-Oct-21 15 1000...
- Anonymous4 years ago
Hi Anonymous ,
I updated your sample pbix file(see attachment), please check whether that is what you want.
Previous Work Day Qty = VAR _curdate = SELECTEDVALUE ( 'Purch Fact'[Purch Date] ) VAR _preworkdate = CALCULATE ( MAX ( 'Calendar'[Date] ), FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] < _curdate && WEEKDAY ( 'Calendar'[Date], 2 ) <= 5 ) ) RETURN IF ( DAY ( _curdate ) = 1, [Total Qty], SUMX ( FILTER ( ALLSELECTED ( 'Purch Fact' ), 'Purch Fact'[Purch Date] = _preworkdate ), [Total Qty] ) ) + 0Best Regards
amitchandak
4 years agoSuper User
Anonymous , You can try like these examples
This Day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
Last Day = CALCULATE(sum('Table'[Qty]), previousday('Date'[Date]))
Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c3243d1f9