Forum Discussion
Show repeat customers within a week
- 2 years ago
Hi GunnerJ
Please refer to the linked discussion:
(the part of repeat in the suggested solution)
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Flag =
VAR CurrentAccountNum = TableB[Account Number]
VAR CurrentTicketDate = TableB[Ticket Date]
VAR PreviousTickets =
FILTER(
TableB,
TableB[Account Number] = CurrentAccountNum &&
TableB[Ticket Date] < CurrentTicketDate &&
TableB[Ticket Date] >= CurrentTicketDate - 7
)
RETURN
IF(
COUNTROWS(PreviousTickets) > 0,
"Yes",
"No"
)
/*After adding this calculated column in Table B, you can use it to flag the tickets for the same customer with previous tickets within a week. If the "Flag" column is "Yes," it means that the customer had a previous ticket within a week; otherwise, it's "No."
Please adjust the column and table names in the formula to match your actual data structure.*/mh2587 Thanks for the reply. My issue is I can't get the values from the two different tables to appear in the same dax. In the code you provided Account# and Ticket Date are actually in seperate tables so when I try and make sure the accounts are the same or I try to compare the dates I can only do one. I've attached a sample file below if you cared to take a look. In the bottom center table all tickets besides the first and last ticket should be flagged as they are within 7 days of the previous ticket for that account. Thanks!
https://www.dropbox.com/scl/fi/rs0opdqye10ujzay5azse/NEW-TMS-TEST.pbix?rlkey=noezwm2tcv8h8z5vw3dukmx2w&dl=0