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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

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 @Anonymous

 

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 @Anonymous

 

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

Anonymous
Not applicable

Thank you!! 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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