Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I need help with trying to figure out how to get a table to show up on Power Bi that works with a date filter to show what customers didn't order between one month an another. I am currently able to have two opposing tables that show all of my customers who order for each perspective month. I.e August 2023 on one table and September 2023 on the other. I just don't know how to show the customers that didn't order in September that did in August.
That still doesn't work for me.
Here is the gist of code what you can use, let me know if you get any errors.
CustomersOrderedInSelectedMonth =
VAR SelectedDate = MAX(DateTable[Date]) // Get the selected date from the slicer
VAR SelectedMonthStart = DATE(YEAR(SelectedDate), MONTH(SelectedDate), 1) // First day of the selected month
VAR SelectedMonthEnd = EOMONTH(SelectedMonthStart, 0) // Last day of the selected month
VAR CustomersSelectedMonth =
CALCULATETABLE(
VALUES(Orders[CustomerID]),
FILTER(
Orders,
Orders[OrderDate] >= SelectedMonthStart &&
Orders[OrderDate] <= SelectedMonthEnd
)
)
VAR PreviousMonthStart = EOMONTH(SelectedMonthStart, -1) + 1 // First day of the previous month
VAR PreviousMonthEnd = EOMONTH(SelectedMonthStart, -1) // Last day of the previous month
VAR CustomersPreviousMonth =
CALCULATETABLE(
VALUES(Orders[CustomerID]),
FILTER(
Orders,
Orders[OrderDate] >= PreviousMonthStart &&
Orders[OrderDate] <= PreviousMonthEnd
)
)
RETURN
EXCEPT(CustomersPreviousMonth, CustomersSelectedMonth)
This would be for a calculated Table?
You have the flexibility to utilize the measure within a calculation group to filter customer IDs. Alternatively, you can apply a CONCATENATEX operation on the measure's result to obtain a resulting string. The choice of how you want to use it is entirely yours.
eg . in case of calculation groups you can probably add following:
VAR Result = EXCEPT(CustomersPreviousMonth, CustomersSelectedMonth)
RETURN CALCULATE( SELECTEDVALUE(Orders[CustomerID]),Orders[CustomerID] IN(Result) )
User | Count |
---|---|
14 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
29 | |
17 | |
11 | |
7 | |
5 |