Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
jshirley
Frequent Visitor

Need help showing customer who ordered month 1 but not month 2

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. 

5 REPLIES 5
jshirley
Frequent Visitor

That still doesn't work for me. 

jshirley
Frequent Visitor

CustomersOrderedInSelectedMonth =
VAR SelectedDate = MAX(Orders[O.ship_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[O.cust.id]),
        FILTER(
            Orders,
            Orders[O.ship_date] >= SelectedMonthStart &&
            Orders[O.ship_date] <= 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[O.cust.id]),
        FILTER(
            Orders,
            Orders[O.ship_date] >= PreviousMonthStart &&
            Orders[O.ship_date] <= PreviousMonthEnd
        )
    )

RETURN
    EXCEPT(CustomersPreviousMonth, CustomersSelectedMonth)
 
When I put in my fields for this code it return a blank field for all the data.
_elbpower
Resolver III
Resolver III

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) )

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.