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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Kevin_Gitonga
Helper I
Helper I

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
v-chuncz-msft
Community Support
Community Support

@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.

View solution in original post

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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