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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
DataIsMyMN
Frequent Visitor

Latest & Earliest Date/Time Function Not Reporting Correctly

I have data that shows the date and time for file reciept; I am trying to create cards that show what the EARLIEST file receipt time was and what the LATEST file receipt time was in the given set of data. I have researched for quite some time and have not found anything to point me to the cause of why this is not reporting correctly... please help! 

 

Here is a sample of the data I am using:

DataIsMyMN_3-1678996068322.png

The earliest time a file was received should be reporting as from 1/24/2023 at 12:01:59 AM and the latest time a file was received should be reporting as 2/2/2023 at 12:16:00 PM; however, when I create a card visual and tell it to report earliest and latest from the Last File Receipt Time field, it is reporting this:

DataIsMyMN_1-1678996016704.png

I have even attempted to create new measures with MIN and MAX functions and it reports the same way.  

 

1 ACCEPTED SOLUTION

@DataIsMyMN Oh, you want the items with the min or max time regardless of date. If that is the case see attached PBIX below signature.

Earliest = 
    VAR __Table = 
        ADDCOLUMNS(
            'Table',
            "Time", [Last File Receipt Time] - TRUNC([Last File Receipt Time])
        )
    VAR __MinTime = MINX(__Table, [Time])
    VAR __Result = MINX(FILTER(__Table, [Time] = __MinTime),[Last File Receipt Time])
RETURN
    __Result
Latest = 
    VAR __Table = 
        ADDCOLUMNS(
            'Table',
            "Time", [Last File Receipt Time] - TRUNC([Last File Receipt Time])
        )
    VAR __MaxTime = MAXX(__Table, [Time])
    VAR __Result = MINX(FILTER(__Table, [Time] = __MaxTime),[Last File Receipt Time])
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
DataIsMyMN
Frequent Visitor

@Greg_Deckler yes, it is a Date/Time column.  I've tried changing the display format to only show the time, but that doesn't fix it. 

@DataIsMyMN Oh, you want the items with the min or max time regardless of date. If that is the case see attached PBIX below signature.

Earliest = 
    VAR __Table = 
        ADDCOLUMNS(
            'Table',
            "Time", [Last File Receipt Time] - TRUNC([Last File Receipt Time])
        )
    VAR __MinTime = MINX(__Table, [Time])
    VAR __Result = MINX(FILTER(__Table, [Time] = __MinTime),[Last File Receipt Time])
RETURN
    __Result
Latest = 
    VAR __Table = 
        ADDCOLUMNS(
            'Table',
            "Time", [Last File Receipt Time] - TRUNC([Last File Receipt Time])
        )
    VAR __MaxTime = MAXX(__Table, [Time])
    VAR __Result = MINX(FILTER(__Table, [Time] = __MaxTime),[Last File Receipt Time])
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler, you are a LIFESAVER, thank you!  This worked beautifully! 

Greg_Deckler
Community Champion
Community Champion

@DataIsMyMN Is that column a Date/Time column?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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