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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Johnn
Frequent Visitor

new customers based off transaction history

Hi,

 

I'm trying to figure out how to idenitfy new merchants based off transaction data. I have a transaction table that has merchant info included. The firstdate function looks like it has worked when I create a table of merchant ID and first transaction date. But I'm not sure how to sum the new merchant IDs per month and show this in a visualization.

 

I'm a new user to power bi so I'm not sure if I'm missing something obvious here.

 

Thanks for any help,

Johnn

1 ACCEPTED SOLUTION

@Johnn

 

taken from  http://www.daxpatterns.com/new-and-returning-customers/  (you will need a datetable for this)

here is an example he provides

 

[New Customers] :=
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( Sales[CustomerKey] ),
            "PreviousSales", CALCULATE (
                COUNTROWS ( Sales ),
                FILTER (
                    ALL ( 'Date' ),
                    'Date'[FullDate] < MIN ( 'Date'[FullDate] )
                )
            )
        ),
        [PreviousSales] = 0
    )
)




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
fhill
Resident Rockstar
Resident Rockstar

Please post some sample or mock data, so we can better understand your table / data structure.  Thank You - FOrrest




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Johnn
Frequent Visitor

 

Hi,

 

This is a sample of what my data looks like:

 

timetest.PNG

 

I just want to say that I had 2 new merchants in Jan 2016 (A and B), 1 new merchant in Feb 2016 (C), and 2 new merchants in March 2016 (E and D). The firstdate function correctly gives what I want but not sure how to count the new merchants to display by month.

 

Capturetest2.PNG

 

Thanks for any help.

 

 

 

@Johnn

 

taken from  http://www.daxpatterns.com/new-and-returning-customers/  (you will need a datetable for this)

here is an example he provides

 

[New Customers] :=
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( Sales[CustomerKey] ),
            "PreviousSales", CALCULATE (
                COUNTROWS ( Sales ),
                FILTER (
                    ALL ( 'Date' ),
                    'Date'[FullDate] < MIN ( 'Date'[FullDate] )
                )
            )
        ),
        [PreviousSales] = 0
    )
)




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Thanks that worked great! Also it seems to have worked fine without any datetable (i just used the date in my transaction table).

@Johnn excellent just be mindful that it could cause issues but if it isn't great its just best practise.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors