Forum Discussion

NBOnecall's avatar
NBOnecall
Icon for Helper V rankHelper V
7 years ago
Solved

Measure to find earliest date in a DirectQuery

Hi,

I am trying to create a measure to find the earliest date where the quantity is <> 0. Below is the example, lets call the table InventoryActivity. The data I am combing through is a direct query, so I can't create a calculated column.

 

 

My Expected results would be EarliestDate = 2/3/2019.

 

Thank you,

Noel

  • Hi NBOnecall ,

     

    Try the following measure:

     

    First date =
    CALCULATE (
        FIRSTNONBLANK ( 'Table'[Date]; 0 );
        FILTER ( ALL ( 'Table'[Quantity] ); 'Table'[Quantity] <> 0 )
    )

    Regards,

    MFelix

1 Reply

  • Hi NBOnecall ,

     

    Try the following measure:

     

    First date =
    CALCULATE (
        FIRSTNONBLANK ( 'Table'[Date]; 0 );
        FILTER ( ALL ( 'Table'[Quantity] ); 'Table'[Quantity] <> 0 )
    )

    Regards,

    MFelix