Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I’ve been struggling with this issue for the last couple of hours. Perhaps you can help me out with it.
I have an ORDER table with order dates and customer ID’s, this is a simplified version of that table:
Order date | Customer ID |
Jan 1 2018 | AA1 |
Jan 2 2018 | AA1 |
Jan 3 2018 | BB2 |
Feb 1 2018 | AA1 |
Feb 1 2018 | CC3 |
Feb 1 2018 | DD3 |
Feb 1 2018 | AA1 |
I also have a separate date table that is marked as a date table, and which is linked to this ORDER table.
I’ve tried creating the following four measures:
What I’m struggling with is that I want to show these numbers in a report, and also want to show the Month over month increase/decrease for each of these segments. Any help is greatly appreciated!
Thanks
Bas
I loaded your example data as table1 into a pbix. The following measures give what you want
Distinct Customer Count = DISTINCTCOUNT ( Table1[Customer ID] )
Two Plus Orders = CALCULATE ( [Distinct Customer Count], FILTER ( Table1, CALCULATE ( COUNTROWS ( Table1 ) ) >= 2 ) )
At least one order in L3M = CALCULATE ( [Distinct Customer Count], DATESINPERIOD ( Table1[Order Date].[Date], ENDOFMONTH ( Table1[Order Date].[Date] ), -3, MONTH ) )
Thank you for the quick reply @Anonymous!
Both formula's don't seem to work for me. But as they work perfectly from your screenshot I think this might has something to do with the rest of my model.
The two plus orders (segment 1) returns blanks, and the At Least One Order in L3M (segment 3) returns the same results as the distinctcount formula (segment 2).
For Segment 1 I've used:
Segment 1 = CALCULATE( CALCULATE( DISTINCTCOUNT('Sales Data'[Customer ID]), FILTER('Sales Data',CALCULATE(COUNTROWS('Sales Data') >= 2)) )
I've tried the same calculation by doing a sum of the amount of orders, but it won't work either. I've checked the data in Excel and there are plenty of customers who have ordered more than twice every month. Could this have anything to do with my date filters in my report? I don't have any page or report filters actived.
Segment 2 is just a distintcount
CALCULATE(DISTINCTCOUNT('Sales Data'[Customer ID]))
For Segment 3 I now have:
CALCULATE( DISTINCTCOUNT('Sales Data'[Customer ID]), DATESINPERIOD ( _Date[Date], ENDOFMONTH (_Date[Date]),-3,MONTH) )
_Date is my date table.
I don't understand what the .[date] part in your formula does, when I add it here things get broken. How should I interpret that?
Thanks!
Bas
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
89 | |
87 | |
82 | |
64 | |
49 |
User | Count |
---|---|
123 | |
109 | |
87 | |
67 | |
66 |