Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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?

 

dax.PNG

 

 

3 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Try this formula:

 

IF(Table1[Order Date]=CALCULATE(MIN(Table1[Order Date]),ALLEXCEPT(Table1,Table1[Personal ID])),1,0)
 
 

View solution in original post

Ashish_Mathur
Super User
Super 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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-piga-msft
Resident Rockstar
Resident 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

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-piga-msft
Resident Rockstar
Resident 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

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Done! 🙂

Ashish_Mathur
Super User
Super 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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you @Ashish_Mathur your formula was very useful!!! Sorry for the late reply 🙂

Anonymous
Not applicable

Try this formula:

 

IF(Table1[Order Date]=CALCULATE(MIN(Table1[Order Date]),ALLEXCEPT(Table1,Table1[Personal ID])),1,0)
 
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.