cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rfernandes Regular Visitor
Regular Visitor

How to find categoric variable by max/min date

Hello everyone, 

 

I want to create a table that summarize my database, i need to show the first day that a client made a purchase and where it was.

 

To find the first buy date, i used Min o date column. But i dont know how to make the "First Buy Store" . It is possible to groupby by first categoric value by the date or something like that?

 

NameDate First BuyFirst Buy Store
Johny1/1/2018C
Lucas3/14/2018B
Brian2/2/2018A

 

This is the sample database:

 

NameDateStoreValue
Johny6/1/2018A12
Johny5/13/2018B10
Johny11/28/2018A85
Johny1/1/2018C34
Johny2/15/2018B56
Lucas11/25/2018B75
Lucas3/14/2018B35
Lucas9/18/2018C45
Lucas7/3/2018C56
Brian2/2/2018A84
Brian3/18/2018A68
Brian10/1/2018C11
Brian9/18/2018B12

 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
affan Established Member
Established Member

Re: How to find categoric variable by max/min date

Hi @rfernandes

 

You can use the below measure to find the first sotre from where thr customer has purchased.

 

 

First store = var _firstdate=MIN(Table1[Date]) 
Return
CALCULATE(
    FIRSTNONBLANK(Table1[Store],
        1),
            FILTER(Table1,_firstdate))

 

I got below result from this measureFirstStore.pngFirst Store

 You can see the pbix file here.

 

 

 

If this helped you, please mark this post as an accepted solution and like to give KUDOS .

 

Regards,

Affan

View solution in original post

2 REPLIES 2
Highlighted
affan Established Member
Established Member

Re: How to find categoric variable by max/min date

Hi @rfernandes

 

You can use the below measure to find the first sotre from where thr customer has purchased.

 

 

First store = var _firstdate=MIN(Table1[Date]) 
Return
CALCULATE(
    FIRSTNONBLANK(Table1[Store],
        1),
            FILTER(Table1,_firstdate))

 

I got below result from this measureFirstStore.pngFirst Store

 You can see the pbix file here.

 

 

 

If this helped you, please mark this post as an accepted solution and like to give KUDOS .

 

Regards,

Affan

View solution in original post

rfernandes Regular Visitor
Regular Visitor

Re: How to find categoric variable by max/min date

Thank you!! 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 112 members 1,611 guests
Please welcome our newest community members: