cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kevin_Gitonga Frequent Visitor
Frequent Visitor

Filter out first transaction for each customer

Hi guys,

 

I want to add a calculated column that sets the very first transaction for a specific customer as a new sale and any subsequent transactions as upgrades. Below is a snap shot of my sales table,

1234.JPG

I want to be able to filter out upgrades or new sales. I have tried to use the FIRSTDATE() and MIN() functions to try and create a conditional column and failed each time. Is there a way i can add a conditional column that sets all first transactions as new sale and every other trasaction as an upgrade???

 

I have also tried using this measure;

New_sale = var NewSale=CALCULATE(MIN('SALES'[sale_date]),ALLEXCEPT(SALES,'SALES'[Customer_id]))
return
CALCULATE(COUNTROWS('SALES'),FILTER('SALES','SALES'[sale_date]<=NewSale))

 

It doesn't work for me because i cant use it to filter.

 

Will appreciate any help i can get.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filter out first transaction for each customer

@Kevin_Gitonga,

 

You may try using RANKX Function and ALLSELECTED Function to add a measure.

https://community.powerbi.com/t5/Desktop/RANKX-excluding-blanks/m-p/397656#M181491

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

Re: Filter out first transaction for each customer

@Kevin_Gitonga,

 

You may try using RANKX Function and ALLSELECTED Function to add a measure.

https://community.powerbi.com/t5/Desktop/RANKX-excluding-blanks/m-p/397656#M181491

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

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 259 members 2,917 guests
Please welcome our newest community members: