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
Alenth
Regular Visitor

Measure for frequency of transactions by Customer ID

Hi everyone,

 

Apologies, I'm quite new to Powerbi & Dax.

Need help with a simple problem - I need to create a measure (or calculated column if that ends up being a better choice?) that sums how frequently unique customers have transacted with us - the end goal being that I can have a visual table that lets me have frequency of transaction in one column, and distinct count of unique customer ids on the right. Ideally I would also like to group frequency of transactions so we can identify how many customers transact only once, or 5+ times or 10+ times in a year (but unsure if I can do this with a measure as well).

 

End result visual example:

 

Frequency of TransactionCustomer Id (distinct count)
1500
2600
3450
4300
5 etc120

 

Data is extremely simple - each customer transaction is one row of detailed data, that has Sales[Customer ID] and  Sales[Transaction count] (which always appears as "1").

 

Example data:

Customer IDBrand PurchasedDateTransaction Count
Joe-12345Brand 101/01/20181
Bob-6234Brand 106/07/20181
Joe-12345Brand 212/01/20181
Anne-7894Brand 220/07/20181
Anne-7894Brand 220/02/20181

 

Thanks so much for any assistance!

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Alenth 

Create a column

Frequency of Transaction = CALCULATE(COUNT(Table1[Transaction Count]),ALLEXCEPT(Table1,Table1[Customer ID]))

Create a measure

Customer Id (distinct count) = CALCULATE(DISTINCTCOUNT(Table1[Customer ID]),FILTER(ALL(Table1),Table1[Frequency of Transaction]=MAX(Table1[Frequency of Transaction])))

2.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
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

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @Alenth 

Create a column

Frequency of Transaction = CALCULATE(COUNT(Table1[Transaction Count]),ALLEXCEPT(Table1,Table1[Customer ID]))

Create a measure

Customer Id (distinct count) = CALCULATE(DISTINCTCOUNT(Table1[Customer ID]),FILTER(ALL(Table1),Table1[Frequency of Transaction]=MAX(Table1[Frequency of Transaction])))

2.png

Best Regards
Maggie

 

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

Hi @v-juanli-msft Hello, I'm wondering if you could help me by explaining how I could modify your solution in order to take the frequency of transactions by Customer Id and Brand Purchace? I really apreciate your help.

 

Anonymous
Not applicable

What if we had other columns like a "size" that we want to filter by. As in, we want the frequency of transaction to calculate for ONLY the transactions (for each customer) that meet the filtered criteria. Is this possible?

Thanks so much @v-juanli-msft , worked like a charm.

 

Really appreciate your help!

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.