cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Murali777
Helper III
Helper III

Calculated Table for distinct Email Id as Key and most recent value of Name

I need derived table for distinct email id with the latest first name and last name based on latest registration date time colum (DateTime column). Please find the below example for your reference.

 

Murali777_0-1655989129714.png

 

Kindly anyone pls help me.

 

@amitchandak @Icey @Jihwan_Kim 

 

1 ACCEPTED SOLUTION

@Murali777 , DAX code

filter(addcolumns(Table, "_Max", maxx(filter(Table, Table[Email] = earlier([Email])), [registration Date])), [_Max] = [registration Date])

 

or

new Table  =

Var _1 = addcolumns(Table, "_Max", maxx(filter(Table, Table[Email] = earlier([Email])), [registration Date]))

return

calculatetable(_1, filter(_1, [_Max] = [registration Date]) )

 



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Murali777 , refer if this blog can help

https://exceleratorbi.com.au/remove-duplicates-keep-last-record-power-query/



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Hi Amit,

 

I need code for calculated table not in the query editor. Kindly help me for DAX code for calculated Table.

@Murali777 , DAX code

filter(addcolumns(Table, "_Max", maxx(filter(Table, Table[Email] = earlier([Email])), [registration Date])), [_Max] = [registration Date])

 

or

new Table  =

Var _1 = addcolumns(Table, "_Max", maxx(filter(Table, Table[Email] = earlier([Email])), [registration Date]))

return

calculatetable(_1, filter(_1, [_Max] = [registration Date]) )

 



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Hi Amit,

 

Thanks for your code and your code is almost working. but my challenge is, i'm having bunch of columns and it returns all the column. 

 

I want only the 3 columns (Email, First Name, Last Name) in the calculated table.

@Murali777 , you can selectcolumns

https://www.sqlbi.com/tv/selectcolumns-dax-guide/

 

 



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors