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
Anonymous
Not applicable

Count number of transactions per customer status

Hi guys, 

 

I have an issue with my formulas in order to calculate the number of transactions each month per customer status.

I have three tables : Customer, Order and Calendar 

My order table looks like this 

Sales order date transaction ID Customer ID Amount 
01/10/2019xxxxxxxx@gmail.com120
02/10/2019xxxxxxxx@gmail.com121
03/10/2019xxxxxxxx@gmail.com122
04/10/2019xxxxxxxx@gmail.com123
05/10/2019xxxxxxxx@gmail.com124
06/10/2019xxxxxxxx@gmail.com125
07/10/2019xxxxxxxx@gmail.com126
08/10/2019xxxxxxxx@gmail.com127
09/10/2019xxxxxxxx@gmail.com128

i tried some of the formulas in this forum but i still don't get the right number: 

Stay Count New Customers =
COUNTROWS(
FILTER(
SUMMARIZE(
Orders,Orders[External ID],
"EFGH",MIN(Orders[Document Number]),
"IJKL",[Stay ID of the first visit]),
[EFGH]=[IJKL]))
 
My issue here is that a customer can buy multiple time during the same month so the measures i used to calculate new and returning customers don't work for transaction count.
 
Thank you in advance 
 
 
Can anyone help me with this ? the formula give less than expected 
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Suppose your tables have relationships like below:

v-jingzhang_0-1601430991564.png

To count the number of transactions per customer, create a measure:

Count of transactions =
VAR customer = SELECTEDVALUE(Customers[Customer ID])
RETURN
CALCULATE(COUNT(Orders[transaction ID ]),FILTER(Orders,Orders[Customer ID] = customer))

Test the result:

09292.jpg

My sample data:

v-jingzhang_2-1601430991570.png

 

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

I cannot understand your requirement.  On the sample data, show the exact result that you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi, 

 

So i would like to have a table to show the number of transaction each month for returning and new customers.

The outcome would look like this : 

New customers Transactions

YearJanfeb MarchAprMay
2020125010005200526123

New customers can have two or three transactions so the formulas for new and returning customers count doesn't work since it count unique customers each month 

This is my formulas now for the tables

New Customers transactions = COUNT ( Orders[Transactions ID] ) - [Transactions Returning]
Returning Customers =
COUNTROWS (
CALCULATETABLE (
VALUES ( Orders[External ID] ),
VALUES ( Orders[External ID] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] >= MIN( ( 'Calendar'[Date] )
)
)
))
 
what i encountered is that it doesn't count all the transactions ..
 
Thank you in advance

Hi,

I just do not understand your question.  Someone who does will help you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Suppose your tables have relationships like below:

v-jingzhang_0-1601430991564.png

To count the number of transactions per customer, create a measure:

Count of transactions =
VAR customer = SELECTEDVALUE(Customers[Customer ID])
RETURN
CALCULATE(COUNT(Orders[transaction ID ]),FILTER(Orders,Orders[Customer ID] = customer))

Test the result:

09292.jpg

My sample data:

v-jingzhang_2-1601430991570.png

 

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

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.