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
Anonymous
Not applicable

Creating a new column with IF statement and related table

I am attempting to create a new column in my table by using an IF statement using fields from both the table being added to and a related table. The two tables are joined with a one-many relationship from 'Claims' to 'Material Numbers with claims'. It is giving me a Token Literal Expected from within Custom Column, where the error is in the apostrophes around the table name. How do I write this best to execute the new column?

 

=IF
([Created on]>09/30/2018,[Claim Item Amt]/(1+RELATED('Material Numbers with claims'[February Price Increase]+'Material Numbers with claims'[March Price Increase]+'Material Numbers with claims'[May Price Increase]+'Material Numbers with claims'[August Price Increase]),
IF
([Created on]>06/30/2018,[Claim Item Amt]/(1+RELATED('Material Numbers with claims'[February Price Increase]+'Material Numbers with claims'[March Price Increase]+'Material Numbers with claims'[May Price Increase]),
IF
([Created on]>04/30/2018,[Claim Item Amt]/(1+RELATED('Material Numbers with claims'[February Price Increase]+'Material Numbers with claims'[March Price Increase),
IF
([Created on]>03/31/2018,[Claim Item Amt]/(1+RELATED('Material Numbers with claims'[February Price Increase]),
[Claim Item Amt])

1 REPLY 1
AnthonyTilley
Solution Sage
Solution Sage

a Few things a wron with your formula 

 

1. you cannot provide muliple columns in one related function 

(1+RELATED('Material Numbers with claims'[February Price Increase]+'Material Numbers with claims'[March Price Increase]+'Material Numbers with claims'[May Price Increase]+'Material Numbers with claims'[August Price Increase])

 

you need to wrap each colunm in a related function 

(1 + RELATED('Material Numbers with claims'[February Price Increase]) + RELATED('Material Numbers with claims'[March Price Increase])+ RELATED('Material Numbers with claims'[May Price Increase]) + RELATED('Material Numbers with claims'[August Price Increase]))
 
2. the end of your formula is incorrect
becuase you have nested 4 if statments inside of each other you need to close all of the brackets 
[Claim Item Amt])))))




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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