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
rfernandes
Helper I
Helper I

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
affan
Solution Sage
Solution Sage

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 measureFirst StoreFirst 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
affan
Solution Sage
Solution Sage

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 measureFirst StoreFirst 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

Thank you!! 

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.