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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Fleurdc
Frequent Visitor

How to lookup the earliest date, then select the related value and pinpoint that (like $ in Excel)

Hi everbody! 


For my project i need to graph prices of different products in an indexed manner (so every line starting from 100). In order to do so, I need to divide each price of each product by the earliest price available for that product. 

 

Then, preferably, i would like to have that if i slice the first date available for a product, that it will take the new first date as the earliest price.

 

So, my question is, does anybody knows a DAX formula with which i can look for the first date available for each supplier/product combination, then select the price corresponding to this date+supplier+product? And then also pin point that related price (as like $ in Excel) so i can divide all other prices by that earliest price? (In that way i calculate the index)

 

My dataset looks like follows:

Fleurdc_0-1702543147647.png

And i would like to show my graph as follows:

Fleurdc_2-1702543298789.png

Would be very helpful! Thank you in advance! 

 

Kind regards,

 

Fleur de Clercq

1 REPLY 1
danextian
Super User
Super User

Hi @Fleurdc ,

 

This is how you can get the earliest price:

Earliest Price by Product by Supplier =
VAR __EARLIEST_DATE =
    CALCULATE (
        MIN ( 'Table'[Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Supplier], 'Table'[Product] )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[Price] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Supplier] = EARLIER ( 'Table'[Supplier] )
                && 'Table'[Product] = EARLIER ( 'Table'[Product] )
                && 'Table'[Date] = __EARLIEST_DATE
        )
    )

As to the related price, please indicate how to achieve this. Also, moving forward, please post a sample data that we can copy-paste (not an image).

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.