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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nrowey
Helper I
Helper I

IF statement between two joined tables on multiple values

I have two joined tables, I want to create a new column containing a value from one table based on a colum value in the other.

e.g   based on table COA1 colum name "accounttype" evaluating to a "S" or a "C" , I want the value from table GLDetail column name "postingamount"   to be added to the new column, if evaluation is not "C" or "S" than 0

 

Tried this and a bunch of others but no luck...

Gross1 = if(COA1[ACCOUNTTYPE]="C" or "S",SUM(GLDetail[postingamount]),0))
3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Shaurya
Memorable Member
Memorable Member

Hi @nrowey,

 

You can use:

 

Gross = IF('COA1'[AccountType] = "C" || 'COA1'[AccountType] = "S",
LOOKUPVALUE('GLDetail'[PostingAmount], 'GLDetail'[JoinColumn], 'COA1'[JoinColumn]), 0)

 

Mark this post as a solution if that works for you!
Consider taking a look at my blog: Forecast Period - Previous Forecasts

Statement I entered and error result below.
thance for any guidence 
Gross = IF('COA1'[AccountType] = "C" || 'COA1'[AccountType] = "S",
LOOKUPVALUE('GLDetail'[PostingAmount], 'GLDetail'[Match], 'COA1'[HOSTITEMID]), 0)
error:
A single value for column 'HOSTITEMID' in table 'COA1' 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
 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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