Forum Discussion
Calculated column from one table to another
- Anonymous2 years ago
Hi Revathi22 ,
Are you referring to going to the Tax Database table based on [Pattern] to find out if there is a matching [Ref_Mark], and if this [Pattern] is all true, then valid.
I created some data:
Customer table:
Tax Database:
Here are the steps you can follow:
1. Add two new steps with code of the following form.
= Table.ReplaceValue(#"Changed Type","","",(x,y,z)=>Text.Combine(Text.SplitAny(Text.From(x),"0123456789"),"9"),{"Taxid"})= Table.ReplaceValue(#"Custom1","","",(x,y,z)=>Text.Combine(Text.SplitAny(Text.From(x),"ABCDEFGHIJKMLNOPQRSTUVWXYZ"),"x"),{"Taxid"})2. Create calculated column.
Test1 = var _column= SELECTCOLUMNS(FILTER(ALL('Tax Database'),'Tax Database'[Country_Code]=EARLIER('Customer table'[Country_Code])),"test",'Tax Database'[Ref_Mark]) retur CONTAINSSTRING( _column,'Customer table'[Taxid])Test2 = var _count= COUNTX(FILTER(ALL('Customer table'),'Customer table'[Country_Code]=EARLIER('Customer table'[Country_Code])&&'Customer table'[Test1]=FALSE()),[Country_Code]) RETURN IF( _count=BLANK(),"Valid","Invalid ")3. Result:
If the above results do not meet your expectations, can you express the expected results in the form of a picture, we can help you better.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thank you so much for your swift response.. But this is not my requiremnent. 🙂
Eg.
If Customer table has
AE - 345678924 in Taxid column
If Taxid_database table has
AE - 999999999 in Ref_Mask then it is Valid since it meets the pattern
But If Taxid database has a ref_mask as
AE - XX99999999 then it is Invalid
Same like above it should check automatically for all the countries and should provide the result for each records in the Customer table whether the details in TaxID column is valid or not.
My another challenge is some countries has multiple pattern wherein the condition needs to check each pattern and if any one met then it is Valid else Invalid.