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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
plugwater
Frequent Visitor

Fetch the right value based on condition

Hi,

 

I need to get the OutputID based on an Indicator in another table from the same group.

 

Can this be done through a DAX formula ?

 

Table 1 : OutputID is field I need to fetch from Table 2.

plugwater_0-1713879532406.png

Table 2 has the grouping in the PrimaryKey and in that group, Valid column if it is X then that entry should be copied to AlternateID.

 

ID_2 is the link between the two tables.

plugwater_1-1713879549819.png

Thanks a lot in advance. 

2 REPLIES 2
Anonymous
Not applicable

Hi @plugwater 

 

For your question, here is the method I provided:

 

Make sure you have the correct relational connections between your tables.

 

vnuocmsft_0-1713939738905.png

 

Create a column.

 

OutputID = 
VAR _Valid = CALCULATE(
    MAX('Table2'[ID_2]),
    FILTER(
        ALL('Table2'),
        'Table2'[ID_2] = EARLIER('Table1'[ID_2]) && 
        'Table2'[Valid] = "X"))
RETURN
_Valid

 

Here is the result.

 

vnuocmsft_1-1713939781126.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for this.

 

This does not work. I applied the formula and I would like the OutputID in all the rows.

 

I am not sure if the MAX condition works here.

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors