Forum Discussion

lboldrino's avatar
lboldrino
Icon for Resolver I rankResolver I
5 years ago
Solved

Create a new column from more columns other table

i have two tables_ fact_fahrzeuge:

kennzeichen
W12300
W12301
W12302
W12303
W12304
W12305
W12307

 

dim_sachkonto

counternamepositiontextbez
1name1W12300 in text 1 W12300_555565
2name2W12301  in text   
3name3W12302  in text 11W12302_34543W12302 dkfkjregn
4name4W12303  in text 2 W12303 terere
5name5W12304  in text 3 W12304 fjjgt
6name6bzzzW!2305-text2 
7name7W12306  
8name8W12307 ztutz  

 

i need a new column "kennzeichen_col" in dim_sachkonto, if position or text or bez contains kennzeichen from fact_fahrzeuge.

 

counternamepositiontextbezKennzeichen_col
1name1W12300 in text 1 W12300_555565W12300
2name2W12301  in text   W12301
3name3W12302  in text 11W12302_34543W12302 dkfkjregnW12302
4name4W12303  in text 2 W12303 terereW12303
5name5W12304  in text 3 W12304 fjjgtW12304
6name6bzzzW12305-text2 W12305
7name7W12306   
8name8W12307 ztutz  W12307

 

any idea please! πŸ™‚

  • Hi lboldrino 

     

    You can create a column with below code

     

    Column = 
    CALCULATE(FIRSTNONBLANK(fact_fahrzeuge[kennzeichen],1),
    FILTER(ALL(fact_fahrzeuge),CONTAINSSTRING(dim_sachkonto[bez],fact_fahrzeuge[kennzeichen]) || 
    CONTAINSSTRING(dim_sachkonto[position],fact_fahrzeuge[kennzeichen]) ||
    CONTAINSSTRING(dim_sachkonto[text],fact_fahrzeuge[kennzeichen])))

     

     

    Note:- W12305 it is not coming for me because its copied as  W!2305 in my data table. But it will works for you πŸ™‚

    Thanks

3 Replies

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    Hi lboldrino 

     

    You can create a column with below code

     

    Column = 
    CALCULATE(FIRSTNONBLANK(fact_fahrzeuge[kennzeichen],1),
    FILTER(ALL(fact_fahrzeuge),CONTAINSSTRING(dim_sachkonto[bez],fact_fahrzeuge[kennzeichen]) || 
    CONTAINSSTRING(dim_sachkonto[position],fact_fahrzeuge[kennzeichen]) ||
    CONTAINSSTRING(dim_sachkonto[text],fact_fahrzeuge[kennzeichen])))

     

     

    Note:- W12305 it is not coming for me because its copied as  W!2305 in my data table. But it will works for you πŸ™‚

    Thanks

  • fhill's avatar
    fhill
    Icon for Resident Rockstar rankResident Rockstar

    What happens if Position = "W12300" and Text contains "W12301", etc?  Do you wan an Error Result if conflicting data in the columns, or do you want the columns to have an Success Order, ignoring the other columns if a result is found?

     

    Forrest

    • lboldrino's avatar
      lboldrino
      Icon for Resolver I rankResolver I

      What happens if Position = "W12300" and Text contains "W12301" - not possible. 

      but for example W12306 is not exist in dim_sackkonto, deshalb null