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
saanah2019
Helper II
Helper II

Find the min and max date

Hi i have a very basic question that I am stuck on.

I have 2 columns from the same table.
Customer Date

Customer    Date
1                 2/2/2018
2                2/6/2018
3                 2/9/2018

so I just want to create a column or measure which will look at each date and then say if it is the min or max date

Customer       Date           Status
1                    2/2/2018       Min
2                   2/6/2018
3                   2/9/2018         Max

1 ACCEPTED SOLUTION

Hi @saanah2019 

You may create a column like below:

Column =
IF (
    'Table'[Date] = MAX ( 'Table'[Date] ),
    "MAX",
    IF ( 'Table'[Date] = MIN ( 'Table'[Date] ), "MIN", BLANK () )
)

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I ran into this same issue earlier today! I was able to find two solutions which I believe might work for you.  I've included the code and link to the other post below. The first solution is through a calculated column and the second is via a measure. 

 

 

Is Latest Row Filter = 
VAR LatestDate = MAXX(FILTER('Table1','Table1'[Type] = EARLIER('Table1'[Type])),'Table1'[Date])
RETURN IF('Table1'[Date]=LatestDate,1,0)

 

Measure =
VAR LatestDate =
    CALCULATE ( MAX ( 'Table1'[Date] ), ALL ( 'table1' ) )
RETURN
    IF ( MIN ( 'Table1'[Date] ) = LatestDate, 1, 0 )

 

https://community.powerbi.com/t5/Desktop/Show-only-data-from-the-latest-date/m-p/443987#M205215

 

Hope these help. 

@Anonymous 
Hey I am not sure why I am not getting the right answer. What am I doign wrong here?
 
Is Latest Row Filter =
VAR LatestDate = MAXX(FILTER(Billing,Billing[Bill Date] = EARLIER(Billing[Bill Date)),Billing[Bill Date)
RETURN IF(Billing[Bill Date=LatestDate,1,0))))
 
Max =
VAR LatestDate =
CALCULATE ( MAX ( Billing[Bill Date] ), ALL ( Billing ) )
RETURN
IF ( MIN ( Billing[Bill Date] ) = LatestDate, 1, 0 )

Hi @saanah2019 

You may create a column like below:

Column =
IF (
    'Table'[Date] = MAX ( 'Table'[Date] ),
    "MAX",
    IF ( 'Table'[Date] = MIN ( 'Table'[Date] ), "MIN", BLANK () )
)

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.