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.
I've built a series of measures that calculate specific measures for a group of customers from my data set, called my comp segment.
My measures work, but they are extremely resource intensive and I'm hoping someone on here can take a look and figure a much better way to run these calculations.
So the problem with my comp segment vs most of what I have researched is this: most of the folks I find building comp segments, their criteria is static, and saved in the table already. For example, show me all customers who bought this specific item already, or show me all sales for all items that match this color, etc. Those are all stored in the calculated tables, making a filter criteria fairly simple and not resource intensive.
My segment is dynamic and 12 month trailing for each period.
For ease, the simplest is customer count. So I'll go through that example:
For this period (starts 6/28/2021), show me the 12 month count of customers (ending end of this period) who in the prior 12 months purchased exactly 2 times.
Because it is rolling, it changes every period. I can't store this data in the database (cleanly), so I wrote a virtual table calculation, and this is where it is messy, and I'm hoping there is a much easier way to solve. Before I show this, for reference, the specific table I'm calling is stored so that each Line is one order.
To get the baseline of the customers who purchased twice in the 12 months prior to the last 12 months the first thing I'm doing is summarizing my table, filtering it to the "LLY" range, and creating a new column to count the total number of lines / orders:
(ALSO, note. I did change this last one to "SELECTCOLUMNS" instead of summarize, but I got similar, perhaps only slightly better results)
So now I have my table where I show the LLY customers who purchased twice, I need to join that to any customers who purchased in the LY / 12 month prior period, I do this with intersect:
I would GROUPBY customer and 12 month periods, aggregate by number of orders and then filter the result to the second (prior) period. That should be reasonably fast.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
55 | |
48 | |
43 | |
19 | |
19 |