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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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