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
Hello,
I want to use i.e. traffic lights to display the status of a customer. Basically I want to show a red light if the customer have not made any order for a longer period of time, compared to his buying pattern (history). For instance if a customer have ordered things usually every week for a long time, and it is now two weeks since his last order, I want to show a red light.
I don't know how I should approach this, especially how to determine the customers buying pattern, and then how to compare that to the last period....
Anyone that have solved a similar problem?
Any help would be deeply appreciated.
Solved! Go to Solution.
I would create a measure that calculates the AVERAGE for a customer. Perhaps like:
Measure 7 = VAR __customer = MAX('Table5'[Customer]) VAR __table = FILTER('Table5',[Customer] = __customer) VAR __table1 = ADDCOLUMNS(__table,"__days",DATEDIFF(MAXX(FILTER(__table,[Date] < EARLIER([Date])),[Date]),[Date],DAY)) RETURN AVERAGEX(__table1,[__days])
I would create a measure that calculates the AVERAGE for a customer. Perhaps like:
Measure 7 = VAR __customer = MAX('Table5'[Customer]) VAR __table = FILTER('Table5',[Customer] = __customer) VAR __table1 = ADDCOLUMNS(__table,"__days",DATEDIFF(MAXX(FILTER(__table,[Date] < EARLIER([Date])),[Date]),[Date],DAY)) RETURN AVERAGEX(__table1,[__days])
Thanks for your answer Greg, much appreciated. I have tried to apply your answer to my data but my knowledge about measures is very limited. Based on your example I tried the following on my specific data:
I finally got it to work, and as I said, it was my lack of understanding of measures. Once I got a hang of that, it was pretty straight forward. Thanks Greg.
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 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |