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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ScripTeapot_
Frequent Visitor

I need to create a table with the first log, given some conditions

Hellor

I need some help with this problem: I have many users and each one has made, at least, one purchase at some point, I need to know the date of the first purchase they have made to count the amount of first purchaces made in a month.

 

OG table

Userpurchase_date
A2023-02-01
A2023-02-14
A2023-03-29
B2023-02-10
C2022-12-23
C2023-07-04
C2023-09-15

 

First purchase table

user"first_purchase"
A2023-02-01
B2023-02-10
C2022-12-23

 

Probably this is not the best way to do this, if someone can guide me to something I can study to achieve this goal is very appreciated.

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @ScripTeapot_ 

You can produce your required output by the following table dax formula.

Sakiko_0-1694564831541.png

In this simple data model, I separately created a calendar table (dimension table) and created a one to many relationship with the fact table because it is the best practice to do so.   

I omit detailed explanations here, but instead, please find attached the link to the pbix file, and please let me know if anything is unclear.

First purchase table.pbix

View solution in original post

1 REPLY 1
DataNinja777
Super User
Super User

Hi @ScripTeapot_ 

You can produce your required output by the following table dax formula.

Sakiko_0-1694564831541.png

In this simple data model, I separately created a calendar table (dimension table) and created a one to many relationship with the fact table because it is the best practice to do so.   

I omit detailed explanations here, but instead, please find attached the link to the pbix file, and please let me know if anything is unclear.

First purchase table.pbix

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.