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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Charles59
New Member

DAX: How to count customers who buys the month of april only and not the others.

Hi everyone, 

I have an issue on DAX that I can't solve, maybe someone could help. 

Here is my example

My problem: I would like to count the number of new customers who bought in April ONLY and not during previous months. 

In our case, 2 new customers (customer C & D)

Let's imagine a purchase teble like below: 

CustomerMonth of purchase
A1
A2
A4
B1
B3
C4
C4
D4
1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

Apr ONLY = 
CONCATENATEX(
    FILTER(
        CALCULATETABLE( VALUES( SALES[Customer] ), SALES[Month of purchase] = 4 ),
        CALCULATE( ISEMPTY( SALES ), SALES[Month of purchase] <> 4 )
    ),
    SALES[Customer],
    ", "
)

ThxAlot_0-1691180068161.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

2 REPLIES 2
ThxAlot
Super User
Super User

Apr ONLY = 
CONCATENATEX(
    FILTER(
        CALCULATETABLE( VALUES( SALES[Customer] ), SALES[Month of purchase] = 4 ),
        CALCULATE( ISEMPTY( SALES ), SALES[Month of purchase] <> 4 )
    ),
    SALES[Customer],
    ", "
)

ThxAlot_0-1691180068161.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



HassanAshas
Helper V
Helper V

Please try the following, 

Count of People = 

var _OtherCustomers = 
    CALCULATETABLE(
        VALUES('Table'[Customer]), 
        'Table'[Month of purchase] < 4
    )

var _Result =
    COUNTROWS(
        SUMMARIZE(
            FILTER(
                'Table', 
                'Table'[Month of purchase] = 4
                &&
                NOT('Table'[Customer] in _OtherCustomers)
            ), 
            'Table'[Customer]
        )
    )

return _Result

 

The idea is to, 

 

  • Find out the Customers who have purchases in the Months less than "4"
  • Filter the Table to only find the people who have done purchases in the Month = 4 and also filter out those Customers in this table who belong to the first list (_OtherCustomers as caluclated above)
  • Summarize this resultant table based upon Customer (so as to find unique number of Customers)
  • Finally count the Rows in the summarized table. This should give you your final answer. 

 

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.