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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
Contributor III

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
Users online (2,086)