Forum Discussion

Mani_1's avatar
Mani_1
Frequent Visitor
3 years ago
Solved

Adding coloumn to table based on filter

Hi,

I am trying to add a coloum company in table 1 based only with type "a", I have tried various dax measure but didn't succeed. Please help me with issue. The data is as follows, 

Thanks in advance

amitchandak Greg_Deckler parry2k 

Table 1:

File
123
456
789
917
CompanyType

File

XX companyar123
Xy company

a

123
bS companyar456
XZ companya2456
by companya456
ca companya3789
ce companya789
cf companya3917
dl companya971
  • Mani_1 assuming there is relationship between Table1 and Company table, and the relationship is 1 to many (one on Table1 side), add following calculated column in Table1

     

    Company = 
    VAR __Table = 
    SELECTCOLUMNS ( 
        FILTER ( 
            RELATEDTABLE ( Company ), Company[Type] = "A" 
        ), 
        "@Company", Company[Company] 
    )
    RETURN MINX ( __Table, [@Company] )

3 Replies

  • Mani_1 assuming there is relationship between Table1 and Company table, and the relationship is 1 to many (one on Table1 side), add following calculated column in Table1

     

    Company = 
    VAR __Table = 
    SELECTCOLUMNS ( 
        FILTER ( 
            RELATEDTABLE ( Company ), Company[Type] = "A" 
        ), 
        "@Company", Company[Company] 
    )
    RETURN MINX ( __Table, [@Company] )