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
Anonymous
Not applicable

Help with Returning Earliest Date based on certain criteria

Hi All, hoping someone might be able to help as I have tried a few different ways to do this but fail each time to get what I need.

 

So I have one table with a list of Products, and the number of times they are used, also includes the week number and date used.

 

I need to create a new column or measure that can return the earliest date for each product whose number is 2 but this would need to filter per week.
 For example I would like to return the earliest date that Product 2 was used 2 times but one value would need to be returned for week 10 and another for week 11. see data set below

 I have tried switch function, Minx and Min but nothing returns what I want just wondering what would give me this result.

 

Table1

Product            No    Week             Data
Product 1        1        10        03/03/2018 12:05
Product 1        1        10        03/03/2018 12:06
Product 1        2        10        03/03/2018 13:05
Product 1        2        10        03/03/2018 13:06
Product 1        2        10        03/03/2018 13:07
Product 2        2        10        04/03/2018 15:07
Product 2        2        10        04/03/2018 15:08
Product 2        2        10        04/03/2018 15:09
Product 2        2        10        04/03/2018 15:10
Product 2        3        10        04/03/2018 17:10
Product 2        3        10        04/03/2018 17:20
Product 3        1        10        05/03/2018 09:20
Product 3        1        10        05/03/2018 09:21
Product 3        1        10        05/03/2018 09:22
Product 3        2        10        05/03/2018 14:20
Product 3        2        10        05/03/2018 14:21
Product 3        2        10        05/03/2018 14:22
Product 2        2        11        11/03/2018 15:07
Product 2        2        11        11/03/2018 15:08
Product 2        2        11        11/03/2018 15:10

 

Any advice or help that anyone could provide would be great as I think my brain has hit its limit with it:)

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Cherry, that worked beautifully, thank you so much, and thank you for quick response. This forum is such a great resource for newbies to powerbi like myself and I am sure more seasoned users. Thanks again really helpful.

View solution in original post

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

By my test with your data sample, the measure below could achive your desired output.

Measure =
CALCULATE (
    MIN ( 'Table1'[Date] ),
    FILTER (
        ALLEXCEPT ( Table1, 'Table1'[Week], Table1[Product] ),
        'Table1'[Number] = 2
    )
)

Here is the output.

Untitled.png

Best  Regards,

Cherry

 

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

Hi @v-piga-msft ,

I have a similar dilemna to this quesiton and trying to incorporate your solution into my calculation and wondering if you can assist.  I have a 'Date Table' with [Date field] and [Week Ending Date] and trying to find the "Earliest" reviewed order date from the 'Data [Reviewed Order Date] that was still open at each 'Date Table' [Week Ending Date]'.  

 

 

Thank you so much,

Tawnee

TwinJohnson_2-1691792165602.png

 

 

 

 

Anonymous
Not applicable

Hi Cherry, that worked beautifully, thank you so much, and thank you for quick response. This forum is such a great resource for newbies to powerbi like myself and I am sure more seasoned users. Thanks again really helpful.

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.