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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Milan_TBC
Frequent Visitor

Calculate Value of First Purchase per Customer

Hi all,

 

In order to make calculations regarding new business flow, i want to see the first purchase price (or deal_id) per customer in the customer data sheet. My sheets are connected as followed:

 

BI link.pngI want to fill the calculated column <First Deal> with the weigthed_value_amount out of the left data set. 
This can be done by finding the first closed_at in the left column. I already have this date in the <First Order Date> in the right data set, however i cannot get it to work with weighted_value_amount. 

 

I have tried LOOKUPVALUE(), and i have tried messing around with TOPN(), however i can not get it to work. 

 

Does someone know how to get this done?

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Milan_TBC ,

 

Please try:

First Deal = 
VAR _min_date =
    CALCULATE ( MIN ( 'Table2'[First Order Date] ), RELATEDTABLE ( 'Table2' ) )
VAR _first_deal =
    CALCULATE (
        MAX ( 'Table2'[First Deal] ),
        FILTER (
            ALL ( 'Table2' ),
            'Table2'[id] = 'Table1'[lead customer id]
                && 'Table2'[First Order Date] = _min_date
        )
    )
RETURN
    _first_deal

vcgaomsft_0-1676957247197.png

vcgaomsft_1-1676957271465.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Milan_TBC ,

 

Please try:

First Deal = 
VAR _min_date =
    CALCULATE ( MIN ( 'Table2'[First Order Date] ), RELATEDTABLE ( 'Table2' ) )
VAR _first_deal =
    CALCULATE (
        MAX ( 'Table2'[First Deal] ),
        FILTER (
            ALL ( 'Table2' ),
            'Table2'[id] = 'Table1'[lead customer id]
                && 'Table2'[First Order Date] = _min_date
        )
    )
RETURN
    _first_deal

vcgaomsft_0-1676957247197.png

vcgaomsft_1-1676957271465.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.