Forum Discussion
Return Earlier or previous Date row data based two conditions - sequence and Tool number
- 4 years ago
Hi,
Please check the below DAX formula and the attached pbix file.
It is for creating a new column.
Previous reason CC = VAR currenttool = Data[Tool] VAR currentdate = Data[Date Out] VAR previousdate = MAXX ( FILTER ( Data, Data[Tool] = currenttool && Data[Date Out] < currentdate ), Data[Date Out] ) VAR currentsequence = Data[Sequence] VAR previoussequence = MAXX ( FILTER ( Data, Data[Tool] = currenttool && Data[Sequence] < currentsequence ), Data[Sequence] ) RETURN MAXX ( FILTER ( Data, Data[Tool] = currenttool && Data[Date Out] = previousdate && Data[Sequence] = previoussequence ), Data[Reason] )
Hello Jiwan,
Thanks for the Solution , It works , Fantastic ...Just that I have the data in seperate Tables , Like Date is n DIM Date , Tool is in DIM Tool and Rest in FACT table.
The Solution works when all the data is in one Table.
Is it possible to create a Measure instead of Column??
Hi,
Thank you for your message.
I do not know how your data model looks like, and please share your sample pbix file. And then I can try to create a more accurate measure that suits your needs.
Thank you.
- Anonymous4 years agoNot applicable
Hello Jihwan
Please find the link from my Google Drive: kish.pbix
https://drive.google.com/file/d/1mGGl2YSFPrkif8liwJuZ9YSFeU9NlkeR/view?usp=sharing
If it does not work let me know.. Will try another option
I have included both version -
All data in single table- Which is working
Date is different table with relationship -
Thank You