cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SSS
Helper I
Helper I

EARLIER function not working with MAX of a group

Good Morning

 

I am struggling with the Earlier function as I am not able to make it work.

 

I have a column called ID, another called DATE and another called TIME

 

as an example:

 

ID           DATE           TIME
1            1/1/2018          5
2            1/1/2018          1
3            1/1/2018          3
1            2/1/2018          6
2            2/1/2018          2
3            2/1/2018          4
...

 

As you can see I have the date, and the time that is taken for ID nº X to finish.

 

I want to calculate a measure that tells me the Maximum time that takes for the ID to be finished, in this case for ID 1 it would be 6 as an example.

 

THe formula that I have used is the following one:

 

Medida = calculate(MAX(Table1[TIME]; FILTER(Table1; Table1[ID] = Earlier(Table1[ID]))

 

But I am not able to make it work as it tells me that there is an error in the Measure.

 

Can anyone help me in order to accomplish this task? Thanks a lot.

 

 

 

 

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Super User
Super User

Hi

Please try replacing earlier with selectedvalue

Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Super User
Super User

Hi

Please try replacing earlier with selectedvalue

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors