The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi,
I am trying to figure out a complex measure and I keep getting stuck. I have added an example table below named "Orders"
I need to create a column to show me how many phone calls (Activity) were made within 3 days of order placement (Order Date) based on each order (Order Number). The dates between the Order Date and Activty are listed in the Days Between/Order Activity column.
For example, on order "456", there are a total of 2 activities, one for the order placement and one for a phone call. I created the below calculation to show me how many total activities were completed for each order number.
Order Number | Activity | Order Date | Activity Date | Days Between Order/Activity | Total Activities |
123 | Order Placed | 1/1/2021 | 1/1/2021 | 0 | 3 |
456 | Order Placed | 1/2/2021 | 1/2/2021 | 0 | 2 |
123 | Phone Call | 1/1/2021 | 1/3/2021 | 2 | 3 |
123 | Phone Call | 1/1/2021 | 1/4/2021 | 3 | 3 |
456 | Phone Call | 1/2/2021 | 1/6/2021 | 4 | 2 |
@houstonh , Create a new column like
countx(filter(table, [Order Number] =earlier([Order Number]) && [Activity Date] >= earlier([Order date]) && [Activity Date] <= earlier([Order date]) +3),[Order number])
User | Count |
---|---|
14 | |
12 | |
7 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
13 | |
7 | |
5 |