Reply
Frequent Visitor
Posts: 12
Registered: ‎11-30-2018
Accepted Solution

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


Accepted Solutions
Established Member
Posts: 201
Registered: ‎07-12-2017

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


All Replies
Established Member
Posts: 201
Registered: ‎07-12-2017

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

Highlighted
Frequent Visitor
Posts: 12
Registered: ‎11-30-2018

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

Thank you!!