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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
carol_mar
Helper I
Helper I

Count how many times a transaction is made, for each costumer

Hello,

hope you'll be able to help me..

 

So, what I have is:

2 Tables related to each other by a many to one relationship. 

The first table contains the names and the Serial Number of each costumer

The secondo table is made by many coloums (Serial Number - day and time of the transaction - transaction $ -...-...)

 

I need to know with which frequency each costumer make a transaction, like:

 

3 times per day this costumer (Serial Number) has made a transaction and how much is the total amount

 

and 

 

10 costumer make 4 transaction every day

 

How can I do that?

 

Thank you so much

 

 

9 REPLIES 9
az38
Community Champion
Community Champion

Hi @carol_mar 

I think you dont even need a programming with your data model

Just add to visual (table for example) columns:

Hierarchy date, Serial Number, Transaction ID (or smth like that) and AMount

 

After go to field pane and set Transaction ID aggregation as Count and Amount Aggregation as Sum

Then pick your DateTime column, go to the Modeling ribbon and set Data Type as Date

In the most common case it should work perfect

 

Безымянный.png

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thank you su much for your time. 

I think it probably works but now, (I'm not an expert yet ahah) I would need to verify it, creating a chart. I obtained a table with "year" "quarter" "monthly" "day " "count of Id" "amount" which make absolutily sense. 

What I would need now is: in the X axis the days and in the Y the number of transaction uccuring before that day cause I need to say for example:

10 costumer make 1 transaction per day

15 costumer make 2 transaction per day

2 costumer make 3 transaction per day..

 

Is it possible? Thank you soo much for helping!

 

az38
Community Champion
Community Champion

@carol_mar 

try to create a new calculated table like

Table2 = SUMMARIZE(
'Table',
'Table'[DateTime], 'Table'[Serial Number],
"Count Transactions", COUNT('Table'[Transaction ID]),
"Total Amount", SUM('Table'[Amount])
)

 

then you could easy (even if you are still not expert 🙂 ) create a bar-chart

date as Axis

and count of transaction id as Value

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thank you so much @az38 !

 

I have another question now.. ahah

 

Do you have idea of how I can display, for EACH costumer, how many days are in between 2 transaction that he made? Again I have a Table with these coloums: 

 

serial number - transaction amount - date and time of each transaction (everything for 1 month) - ... - ... 

 

I would like to obtain the following table:

 

Serial Number - date - number of paymnt before that date - date - days in between 

 

Basically i need to know the frequency of these payment.. if the make a transaction every day or each two days etc..

Save meee 😬

 

Thank you so much!!

az38
Community Champion
Community Champion

@carol_mar 

just give an example of your data source and outpu with some dummy data

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

 

As you can see Serial number is repeated more times in a day (t means number of transaction).

The time I don't care.

I needto know this guy SM60R-05-0000A248 (i.e.) how often make a transaction, like:

1 transaction per day

1 transaction each 2 days

.... etc

 

THANK YOU😅😊

 
amountSerial_numberdatetime
100SM60R-05-0000A24801/04/201903:17:22
56SM60R-05-0000A24801/04/201904:37:39
50SM5R-04-00006F2001/04/201905:30:26
100SM5R-04-00006F7A01/04/201907:13:32
150SM5R-04-00006F8301/04/201907:37:29
100SM5R-04-00006EA701/04/201907:37:40
100SM5R-04-00006F0301/04/201907:42:33
100SM5R-04-00006F0301/04/201907:43:45
100SM60R-05-0000A23901/04/201907:48:11
50SM5R-04-00006EE901/04/201909:07:57
300SM60R-05-0000A25801/04/201909:48:33
100SM5R-04-00006FC601/04/201911:35:17
100SM5R-04-00006EA701/04/201914:02:50
50SM5R-04-00006F9601/04/201914:10:47
90SM5R-04-00006F2701/04/201914:11:12
100SM60R-05-0000A23901/04/201914:58:01
az38
Community Champion
Community Champion

@carol_mar 

if your data will look like 

amountSerial_numberdatetime
100SM60R-05-0000A24801.04.20193:17:22
56SM60R-05-0000A24801.04.20194:37:39
5454SM60R-05-0000A24807.04.20194:37:39
343SM60R-05-0000A24801.05.20194:37:39
23SM60R-05-0000A24802.05.20194:37:39
54SM60R-05-0000A24801.01.20204:37:39
6SM60R-05-0000A24802.01.20204:37:39

what exactly result do you expect?

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38  something like:

 

Serial numberDatepayment [1-100]Previous payment DateDays in Between 
SM60R-05-0000A2481st April10- 
SM60R-05-0000A2483rd April21st April2 
  ...3rd April  
      
SM60R-05-0000A4542st April10- 
SM60R-05-0000A4546rd April22st April4 
  ...6rd April- 
      
SM60R-05-0000A6661st April10- 
SM60R-05-0000A66610rd April21st April9 
  ...10rd April- 

 

means that I can have a table were for each costumer, considering a range of max 100 transaction per day(which is super high) i know the real number of days after each transaction. Do you get what I mean?

az38
Community Champion
Community Champion

@carol_mar 

what is payment [1-100] column? simple rank? if so, try column

payment [1-100] = RANKX( ALL([Serial number]), [Date])

also try measures

Previous payment Date = 
var _prevDate = CALCULATE(MAX(Table[Date]), ALLEXCEPT(Table, Table[Serial number]), Table[Date]<MAX(Table[Date]))
RETURN
if(ISBLANK(_prevDate), 0, _prevDate)

 and 

Days in Between = DATEDIFF([Previous payment Date], SELECTEDVALUE(Table[Date), DAY)

 

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors