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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PbiCeo
Helper II
Helper II

How to get value from a calculated column on a different table

I created a calculated column on TableA:

Years = IF('TableA'[Div] = "AA1", 1, DATEDIFF('TableA'[StarDate], TODAY(), Year))

 

A I want to get the above value on TableB:

YearsRef = 'TableA'[Years]

 

But got an error like that:

A single value for column 'xxxxx' in table 'xxxxxx' cannot be determined.
This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

Any advice please to solve that?
Thanks in advance,
Vadi

2 REPLIES 2
mahoneypat
Employee
Employee

It depends on the relationship between Tables A and B.  If Table A is on the 1 side, you can use RELATED('TableA'[Years]).  If reversed, you can use RELATEDTABLE() and an aggregation function like MIN() to get to your result.  You can also use LOOKUPVALUE(), in many situation or if no relationship at all.

 

You should also consider doing what you need with measures instead of calculated columns.  Much of what is done in columns should be done in measures.

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi Pat,

 

Thank you for your advice.

There is no relationship between two tables and I can make a relationship many to many only.

Years column has values on TableA like the following:
1

1

8

I want to get these same values on TableB.
Thank you,

Vadi

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors