Forum Discussion
thongnguyen2414
4 years agoFrequent Visitor
Using variable to calculate data of previous date & current date
Greetings all, and Have a nice Monday 😚 1. I am in need of calculate data of current date, but need to pick up result form the previous date. (Because my data is too much with variety of date,...
- Anonymous4 years ago
My bad...mistakenly clicked the button to accept the solution...
I modified the one from Anonymous a little bit
Previous WIP1 = CALCULATE(SUM([Today WIP]),FILTER('Data', 'Data'[Description]=EARLIER('Data'[Description]) &&'Data'[Date]<EARLIER('Data'[Date]) &&'Data'[Line]=EARLIER('Data'[Line]) &&'Data'[File No]=EARLIER('Data'[File No]) &&[Op. No]=EARLIER('Data'[Op. No])))Anonymous how can I undo Accept the solution?
Anonymous
4 years agoNot applicable
thongnguyen2414
I created today WIP and previousdate WIP columns with a bit simplified logic, please check the dax for detail.
Today WIP =
var curOPno = [Q'ty]
var PreOpno = CALCULATE(SUM([Q'ty]),FILTER('Data',
'Data'[Description]=EARLIER('Data'[Description])
&&'Data'[Date]=EARLIER('Data'[Date])
&&'Data'[Line]=EARLIER('Data'[Line])
&&'Data'[File No]=EARLIER('Data'[File No])
&&[Op. No]=EARLIER('Data'[Op. No])-1))
Return IF([Op. No]=1,0,curOPno-PreOpno)
var curOPno = [Q'ty]
var PreOpno = CALCULATE(SUM([Q'ty]),FILTER('Data',
'Data'[Description]=EARLIER('Data'[Description])
&&'Data'[Date]=EARLIER('Data'[Date])
&&'Data'[Line]=EARLIER('Data'[Line])
&&'Data'[File No]=EARLIER('Data'[File No])
&&[Op. No]=EARLIER('Data'[Op. No])-1))
Return IF([Op. No]=1,0,curOPno-PreOpno)
Previous WIP =
CALCULATE(MAX([Today WIP]),FILTER('Data',
'Data'[Description]=EARLIER('Data'[Description])
&&'Data'[Date]=EARLIER('Data'[Date])-1
&&'Data'[Line]=EARLIER('Data'[Line])
&&'Data'[File No]=EARLIER('Data'[File No])
&&[Op. No]=EARLIER('Data'[Op. No])))
CALCULATE(MAX([Today WIP]),FILTER('Data',
'Data'[Description]=EARLIER('Data'[Description])
&&'Data'[Date]=EARLIER('Data'[Date])-1
&&'Data'[Line]=EARLIER('Data'[Line])
&&'Data'[File No]=EARLIER('Data'[File No])
&&[Op. No]=EARLIER('Data'[Op. No])))
'
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
If this post helps, please Accept it as the solution to help the other members find it more quickly.
thongnguyen2414
4 years agoFrequent Visitor
Dear Anonymous
Thank you so much for your advice.