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 community!
I have a problem with DAX. I would like to get the number of days between orders (not the same product) for a customer. I've watched a youtube video "Calculate The Difference In Days Between Purchases Or Events In Power BI Using DAX" and tried to implement his solution with the addition for the current customer:
Let's pretend that the partnerid 265100025029 and 26510002563 are the same customer with the email john.doe@gmail.com.
How would I alter the previos dax code to add additional column, where I would have calculated days between orders by customers?
Any help is highly appreciated.
Uros
What is it that you're trying to calculate? The average number of days between orders? Or the number of days between the latest order in the current context and the previous one? Or maybe the number of days between the latest order in the context and the one before without taking into account the current context? It's not clear what it is and there are many possibilities. As I've already said, by writing a general measure and then slicing by dimensions you can easily get many different meaningful results. If you, for instance, slice by emails, you should get what you want (but you have to really specify exactly what the measure means).
Hi @urosgodnov
Would you please provide a screenshot of the expected visual for better understanding?
Actually, it's easier than you think. Create the measure to be fully general, without paying attention to parterid or customer at all. Just calculate the difference between what's currently been selected. Then by selecting a single email address from your dimension you'll get what you want.
User | Count |
---|---|
14 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
13 | |
8 | |
5 |