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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
DavidK85
Frequent Visitor

Find the first occurance by time

Hi,

 

I have a data set where I am trying to find the first and last occurance of an id number by time, but I can only find solutions by date:

 

DavidK85_1-1713260481411.png

As you can see from the data set above, all the the changes to 'PESpread' occur within the same date but at different times. I am looking to find the 'PESpread' value that occurred first and last within the day for each dealId then find the difference. So I would like to create a table in my dashboard that will say something like this:

 

DealIDBorrower NamePricing DateFirst PESpreadLast PESpreadDifference
13900134Hong Kong Airport Authority02/01/20244.23.83

0.37

 

Is this possible?

 

Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@DavidK85 , In case you need a column

 

 

First time =

var _time = minx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) ), [PE Time])

rerurn

minx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) && [PE Time] =_time) , [PE Spread])


Last time =

var _time = Maxx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) ), [PE Time])

rerurn

Maxx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) && [PE Time] =_time) , [PE Spread])


In case you need Measures

 

First time =

var _time = minx(filter(allselected(Table), [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) ), [PE Time])

rerurn

minx(filter(Table, [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) && [PE Time] =_time) , [PE Spread])


Last time =

var _time = Maxx(filter(allselected(Table), [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) ), [PE Time])

rerurn

Maxx(filter(Table, [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) && [PE Time] =_time) , [PE Spread])

 

 

Latest Date
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@DavidK85 , In case you need a column

 

 

First time =

var _time = minx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) ), [PE Time])

rerurn

minx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) && [PE Time] =_time) , [PE Spread])


Last time =

var _time = Maxx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) ), [PE Time])

rerurn

Maxx(filter(Table, [Borrower.Name] = earlier( [Borrower.Name]) && [Pricing Date] = earlier([Pricing Date]) && [PE Time] =_time) , [PE Spread])


In case you need Measures

 

First time =

var _time = minx(filter(allselected(Table), [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) ), [PE Time])

rerurn

minx(filter(Table, [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) && [PE Time] =_time) , [PE Spread])


Last time =

var _time = Maxx(filter(allselected(Table), [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) ), [PE Time])

rerurn

Maxx(filter(Table, [Borrower.Name] = max( [Borrower.Name]) && [Pricing Date] = max([Pricing Date]) && [PE Time] =_time) , [PE Spread])

 

 

Latest Date
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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