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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! 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.LeanAndPractise(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.LeanAndPractise(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
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors