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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
NRS_Tych
Frequent Visitor

Minimum Purchase Date for a Customer

Hi,

 

I am trying to find the First Purchase Date for the customers.

So in the screenshot below, for this customer First Purchase Date is 4th Sep, but when I add Month Year to the table, the First Purchase Date gets updated to the Min(PurchaseDate) for that Month.  I am trying to find the Transaction Frequency of the customer and this messes up my calculation. Could someone help me with fixing this ?

 

 

NRS_Tych_0-1678452317271.png

 

Thank you!

 

 

1 ACCEPTED SOLUTION
MohammadLoran25
Super User
Super User

Hi,

Create a calculated column in your Customer Dimension as below:

 

CALCULATE (
    MIN ( 'Date Table'[DateColumn] ),
    RELATEDTABLE ( 'Pucrchase Fact Table' )
)

Then your problem would be solved.

 

Best Regards.

View solution in original post

3 REPLIES 3
NRS_Tych
Frequent Visitor

Thank you! They all are in a combined table. Should I create a date table which will make it easier ?

Yes it is better to make a separate dimension for that.

But If you don't want to create a dimension you can create a measure as below just based on your combined table:

 

VAR _CUSTOMER =
    SELECTEDVALUE ( CustomerPurchaseFactTable[CustomerID] )
RETURN
    CALCULATE (
        MIN ( CustomerPurchaseFactTable[MonthYear] ),
        FILTER (
            ALL ( CustomerPurchaseFactTable ),
            CustomerPurchaseFactTable[CustomerId] = _CUSTOMER
        )
    )

 

Regards,

Loran

MohammadLoran25
Super User
Super User

Hi,

Create a calculated column in your Customer Dimension as below:

 

CALCULATE (
    MIN ( 'Date Table'[DateColumn] ),
    RELATEDTABLE ( 'Pucrchase Fact Table' )
)

Then your problem would be solved.

 

Best Regards.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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