Forum Discussion
Insert value in new column and use EARLIER function
Hi guys,
I have a question:
I need to identify the first order (based on the date) for the person and insert "1" into the new column and for other orders (which are not first) insert 0.
One person can have 2 or more orders but 1 personal id.
Which DAX formula should I use?
- Anonymous7 years ago
Try this formula:
IF(Table1[Order Date]=CALCULATE(MIN(Table1[Order Date]),ALLEXCEPT(Table1,Table1[Personal ID])),1,0) Hi,
Try this calculated column formula
=IF(Data[Date Created]=CALCULATE(MIN(Data[Date Created]),FILTER(Data,Data[Personal id]=EARLIER(Data[Personal id]))),1,0)
Hope this helps.
Hi Anonymous,
By my tests, the solution from Ashish_Mathur and Arslan should be helpful.
If you have solved your problem, please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please feel free to ask.
Best Regards,
Cherry
5 Replies
- AnonymousNot applicable
Try this formula:
IF(Table1[Order Date]=CALCULATE(MIN(Table1[Order Date]),ALLEXCEPT(Table1,Table1[Personal ID])),1,0) - Ashish_MathurSuper User
Hi,
Try this calculated column formula
=IF(Data[Date Created]=CALCULATE(MIN(Data[Date Created]),FILTER(Data,Data[Personal id]=EARLIER(Data[Personal id]))),1,0)
Hope this helps.
- AnonymousNot applicable
Thank you Ashish_Mathur your formula was very useful!!! Sorry for the late reply :)
- v-piga-msftResident Rockstar
Hi Anonymous,
By my tests, the solution from Ashish_Mathur and Arslan should be helpful.
If you have solved your problem, please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please feel free to ask.
Best Regards,
Cherry
- AnonymousNot applicable
Done! :)