March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All,
The aim is to flag when a customer calls by telephone three times or more within 5 days.
Here's an example of the desired outcome, the first 4 columns are already in the dataset:
The rows for each customer are already grouped with an index number.
I created a simplified PBIX-file, however since I'm not a super user it seems not possible to upload it here. The data model is this:
Hopefully this is sufficient info, otherwise please let me know so I can clarify.
Thanks!
Solved! Go to Solution.
Hi @GKJARC ,
According to your description, it seems that the values of flag(Index 1 , 2 , 3) should be 1. If I misunderstood, please clearify the real logic.
Or if your logic is flag when a customer calls by telephone three times or more within 5 days, please try:
Flag =
VAR _a =
COUNTROWS (
FILTER (
'Table',
[Customer name] = EARLIER ( 'Table'[Customer name] )
&& [Call date]
>= EARLIER ( 'Table'[Call date] ) - 5
&& [Call date]
<= EARLIER ( 'Table'[Call date] ) + 5
)
)
RETURN
IF ( _a >= 3, 1, 0 )
Final output:
Hi @GKJARC ,
According to your description, it seems that the values of flag(Index 1 , 2 , 3) should be 1. If I misunderstood, please clearify the real logic.
Or if your logic is flag when a customer calls by telephone three times or more within 5 days, please try:
Flag =
VAR _a =
COUNTROWS (
FILTER (
'Table',
[Customer name] = EARLIER ( 'Table'[Customer name] )
&& [Call date]
>= EARLIER ( 'Table'[Call date] ) - 5
&& [Call date]
<= EARLIER ( 'Table'[Call date] ) + 5
)
)
RETURN
IF ( _a >= 3, 1, 0 )
Final output:
You're right, the first 3 rows in the example data should also be flagged.
Thanks for your solution!
Table in text format:
Index | Customer name | Call date | DateInteger |
1 | Joe | 08-05-2022 08:25:00 | 20220508 |
2 | Joe | 08-05-2022 10:30:00 | 20220508 |
3 | Joe | 08-05-2022 13:00:00 | 20220508 |
4 | Joe | 16-05-2022 14:30:00 | 20220516 |
5 | Joe | 16-05-2022 15:00:00 | 20220516 |
6 | Joe | 17-05-2022 14:30:00 | 20220517 |
7 | Joe | 18-05-2022 15:00:00 | 20220518 |
8 | Joe | 20-05-2022 15:20:00 | 20220520 |
9 | Joe | 02-08-2022 10:12:00 | 20220802 |
10 | Joe | 10-08-2022 10:12:00 | 20220810 |
11 | Joe | 17-08-2022 10:12:00 | 20220817 |
12 | Joe | 19-08-2022 10:12:00 | 20220819 |
1 | Peter | 04-05-2022 09:05:00 | 20220504 |
2 | Peter | 20-05-2022 11:00:00 | 20220520 |
3 | Peter | 22-05-2022 09:00:00 | 20220522 |
4 | Peter | 23-05-2022 09:05:00 | 20220523 |
5 | Peter | 06-09-2022 09:05:00 | 20220906 |
6 | Peter | 06-09-2022 16:00:00 | 20220906 |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |