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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Daniel_Fdrvc
Helper I
Helper I

Add latest value from one table to another

Hello,

 

i've got some issues with adding latest value from one table to another, maybe someone could help me. So.. I've created new calculated table that stores distinct UNIQUE ID values from two other tables (1 table on attached screen). In third table (2 table) i have unique id's, some values, dates and calculated column, that calculates lates value by date for that ID. Now i need to add that calculated latest value from 2 table to a 1 table. Relations betweens this tables looks like 1 to * and that's the issue - the formula does not know which value to transfer from 2 table to 1 table. How can i solve that? Any suggestions?

 

image001.png

1 ACCEPTED SOLUTION
Daniel_Fdrvc
Helper I
Helper I

You won't believe... because latest value for same ID is always the same, even if that ID appears two or more times, simple lookupvalue function solves me everything. 

View solution in original post

5 REPLIES 5
Daniel_Fdrvc
Helper I
Helper I

You won't believe... because latest value for same ID is always the same, even if that ID appears two or more times, simple lookupvalue function solves me everything. 

v-kkf-msft
Community Support
Community Support

Hi @Daniel_Fdrvc ,

 

Please try the following formula:

 

Latest value = 
VAR latestDate =
    CALCULATE (
        MAX ( 'Table 2'[Date] ),
        FILTER ( 'Table 2', 'Table 2'[ID] = 'Table 1'[Unique ID] )
    )
VAR latestValue =
    MAXX (
        FILTER (
            'Table 2',
            'Table 2'[ID] = 'Table 1'[Unique ID]
                && 'Table 2'[Date] = latestDate
        ),
        'Table 2'[Value]
    )
RETURN
    latestValue

vkkfmsft_0-1643961972585.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@Daniel_Fdrvc Perhaps:

Latest value column =
  VAR __Rows = SELECTCOLUMNS('Table2',"__LatestValues",[Latest value])
RETURN
  IF("no" IN __Rows,"no","yes")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler this add's to all unique id's in 1 table same value, for example - yes 😞

@Daniel_Fdrvc I assumed the tables were related to one another, try:

Latest value column =
  VAR __ID = [Unique ID]
  VAR __Rows = SELECTCOLUMNS(FILTER('Table2',[ID] = __ID),"__LatestValues",[Latest value])
RETURN
  IF("no" IN __Rows,"no","yes")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.