Forum Discussion

ecalzavara's avatar
ecalzavara
Icon for Advocate II rankAdvocate II
5 years ago

How to find valid values based on multiple tables

Hi guys,

I use this forum so much and I have almost found the answer I am after... Except for this one.

 

I have a table with:

  • attributes name
  • attributes values
  • name of the valid-values reference table
  • name of the specific valid-values column (if exists)

 

The first table below is basically my raw data:

AttributesValueData validationSpecific?
Num11TableNumTN_C1
Num22TableNumTN_C1
Num33TableNumTN_C1
Text14TableTxtTT_C1
Text25TableTxtTT_C1
Text3aTableTxtTT_C1
Num4bTableNum 
Num58TableNum 
Text49TableTxt 

 

The third column specifies another table name where to find the only possible valid values, being:

TableNum:

TN_C1TN_C2
1

one

2two
3three
4four
5five
6six
7seven
8eight
9nine
10ten

and

TableTxt:

TT_C1
a
b
c
d
e
f

 

If we want to make it more complex, the fourth column in the raw data table specifies which column to look for in the valid values table.

 

I am trying to get a calculated column (I believe?) that reports TRUE if the values are present in the specific reference table/column, otherwise FALSE.

 

I managed to get close to what I want by creating a calculate column for:

ValidNum? = if(all_data[Value] IN DISTINCT(TableNum[TN_C1]),"Valid","Invalid")
 
What I need now, is to generalise this statement and not to have to specify/hard-code the name of the valid-values table, but making the formula understand that the valid-values table name is in the original table in the (third) column named "Data validation".
 
AttributesValueData validationSpecific?Valid
Num11TableNumTN_C1TRUE
Num22TableNumTN_C1

TRUE

Num33TableNumTN_C1TRUE
Text14TableTxtTT_C1FALSE
Text25TableTxtTT_C1FALSE
Text3aTableTxtTT_C1TRUE
Num4bTableNum FALSE
Num58TableNum TRUE
Text49TableTxt FALSE
I think my explanation can be a bit cumbersome but the solution shouldn't be so difficult... just I can't get there.
 
Thank you so much in advance!

8 Replies

  • ecalzavara 

    is this what you want?

    Column = if(LEFT('Table'[attributes],3)="Num" && ISNUMBER('Table'[Value]),TRUE(),FALSE())
    • ecalzavara's avatar
      ecalzavara
      Icon for Advocate II rankAdvocate II

      Thank you for your quick answer ryan_mayu . Unfortunately is not that easy. I am not only trying to find numbers but to associate the raw data with possibly many different tables containing a set of values, which make my data VALID or INVALID depending if the value on a specific row [Value] is found in the specified table [Data validation] (and, as next step, to be found in a specific column in that [Data validation] table, explicit in [Specific?] column.

       

      Thank you for your go, really appreciated!

      • ryan_mayu's avatar
        ryan_mayu
        Icon for Super User rankSuper User

        ecalzavara 

        sry, not clear about your request. so your raw data only contains two columns? How you get the third column and forth column?