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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Syndicate_Admin
Administrator
Administrator

Help with calculating new customers based on their purchases only in the last month

Dear

I want to calculate the new customers who bought out of 1 in the last month and that the months before the current month are blank.

In excel I make the detailed formula in the image:

fórmula.jpg

The sum corresponds to all the months prior to the current one and if the current month is greater than 1.

Please if you can help me with a Dax for this one or some alternative to replicate this in PowerBi.

Thanks a lot

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Syndicate_Admin 

 

I have simulated some data that I hope fits your description.

Column = VAR n1 = 
CALCULATE (
    COUNT ( 'Table'[Customer] ),
    FILTER (
        'Table',
        [Purchase time].[MonthNo]
            = MONTH ( TODAY () ) - 1
            && [Customer] = EARLIER( ( 'Table'[Customer] )
    )
))  Var n2 =
CALCULATE (
    COUNT ( 'Table'[Customer] ),
    FILTER (
        'Table',
        [Purchase time].[MonthNo]
            <> MONTH ( TODAY () ) - 1
            && [Purchase time].[MonthNo] <> MONTH ( TODAY () )
            && [Customer] = EARLIER ( 'Table'[Customer] )
    )
)
Return IF(n1>=1&&n2=0,"New",BLANK())

vzhangti_0-1640584989897.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Share some data, describe the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Syndicate_Admin
Administrator
Administrator

thank you very much for the help, but I have a doubt.

&& [Customer] = EARLIER( ( 'Table'[Customer] )

In that part my custumer table has to be a measure? I can't add only the greetings field

Hi, @Syndicate_Admin 

 

Can you provide easy PBIX files for testing? I would like to know the format of custumer table. Looking forward to your reply.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

v-zhangti
Community Support
Community Support

Hi, @Syndicate_Admin 

 

I have simulated some data that I hope fits your description.

Column = VAR n1 = 
CALCULATE (
    COUNT ( 'Table'[Customer] ),
    FILTER (
        'Table',
        [Purchase time].[MonthNo]
            = MONTH ( TODAY () ) - 1
            && [Customer] = EARLIER( ( 'Table'[Customer] )
    )
))  Var n2 =
CALCULATE (
    COUNT ( 'Table'[Customer] ),
    FILTER (
        'Table',
        [Purchase time].[MonthNo]
            <> MONTH ( TODAY () ) - 1
            && [Purchase time].[MonthNo] <> MONTH ( TODAY () )
            && [Customer] = EARLIER ( 'Table'[Customer] )
    )
)
Return IF(n1>=1&&n2=0,"New",BLANK())

vzhangti_0-1640584989897.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Greg_Deckler
Community Champion
Community Champion

@Syndicate_Admin See if this helps: New and Returning Customers - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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.

Top Solution Authors
Top Kudoed Authors