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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper IV

## DAX: Testresult within first 60mins

Hi,

Need help on DAX to determine the latest TestResult within the first 60mins (highlighted in yellow). Sample data as below.

Sample table (Final TestResults may or maynot exceed 60mins)

DAX use to calculate TestResult Final and TestResult First

```TestTimeFr = CALCULATE ( MIN ( 'Data'[TestTime_TC1]); FILTER ( 'data'; 'Data'[SerialNumber] = EARLIER ( 'Data'[SerialNumber] ) && data[station] = EARLIER ( 'Data'[station] ) ) )

TestResultsFr = IF(Data[TestTime]=Data[TestTimeFr];Data[TestResult];"null")

TestTimeFn = CALCULATE ( MAX ( 'Data'[TestTime]); FILTER ( 'data'; 'Data'[SerialNumber] = EARLIER ( 'Data'[SerialNumber] ) && data[station] = EARLIER ( 'Data'[station] ) ) )

TestResultsFn = IF(Data[TestTime]=Data[TestTimeFn];Data[TestResult];"null")```

1 ACCEPTED SOLUTION
Microsoft Employee

Hi @vincentakatoh,

Please create calculated columns using the formula below.

```duration =
IF ( DATEDIFF ( Data[TestTimeFr], Data[TestTime_TC1], MINUTE ) < 60, 1, 0 )

latest TestResult within the first 60mins =
CALCULATE ( MAX ( Data[TestTime_TC1] ), FILTER ( Data, Data[duration] ) )
```

You will get the following expected result.

Best Regards,
Angelia

2 REPLIES 2
Microsoft Employee

Hi @vincentakatoh,

Please create calculated columns using the formula below.

```duration =
IF ( DATEDIFF ( Data[TestTimeFr], Data[TestTime_TC1], MINUTE ) < 60, 1, 0 )

latest TestResult within the first 60mins =
CALCULATE ( MAX ( Data[TestTime_TC1] ), FILTER ( Data, Data[duration] ) )
```

You will get the following expected result.

Best Regards,
Angelia

Helper IV

Thanks. Works pefectly on my actual data. I'm only able to do so much with PowerBI because all the great folks in this forum.

Super Kudos!

## Helpful resources

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Join our Community Sticker Challenge

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

#### Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors