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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PhilippeMuniesa
Resolver I
Resolver I

vlookup

hello,

(from france)

 

I want to identify in a new column (powerpivot with DAX) the values that exist in column A and in column B.

 

ex

 

col A    col  B     newCol

1           null          1

2            1             1

3           null         null

4             5            5

5            null         5

 

Thank you for your help

 

Philippe

1 ACCEPTED SOLUTION

I think PowerPivot allows CONTAINS.

 

I'm not completely sure I understand your logic but try this:

newCol = 
    IF (
        ISBLANK ( 'Table'[ColB] ),
        IF (
            CONTAINS ( 'Table', 'Table'[ColB], 'Table'[ColA] ),
            'Table'[ColA]
        ),
        'Table'[ColB]
    )

 

AlexisOlson_0-1668040800479.png

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@PhilippeMuniesa Try:

newCol =
  VAR __B = SELECTCOLUMNS(ALL('Table'),"__C",[B])
  VAR __A = SELECTCOLUMNS(ALL('Table'),"__C",[A])
  VAR __AinB = IF([col A] IN __B,[col A],BLANK()) 
  VAR __BinA = IF([col B] IN __A,[col B],BLANK())
  VAR __Return = MAXX(FILTER(UNION(__AinB, __BinA),[__C] <> BLANK()),[__C])
RETURN
  __Return


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I had trouble following what this is trying to do, but it did inspire this solution:

newCol = 
VAR _ColB = VALUES ( 'Table'[ColB] )
VAR _CurrRow = { 'Table'[ColA], 'Table'[ColB] }
RETURN
    MAXX ( INTERSECT ( _ColB, _CurrRow ), 'Table'[ColB] )

it seems that the IN operator is not operational in Powerpivot would there be another solution? thank you

 

philippe

I think PowerPivot allows CONTAINS.

 

I'm not completely sure I understand your logic but try this:

newCol = 
    IF (
        ISBLANK ( 'Table'[ColB] ),
        IF (
            CONTAINS ( 'Table', 'Table'[ColB], 'Table'[ColA] ),
            'Table'[ColA]
        ),
        'Table'[ColB]
    )

 

AlexisOlson_0-1668040800479.png

thank you, 

It' s ok, 

in the meantime, I tried a solution similar to yours,

"for english must replace ; by ,"

 

=if(Ta_Base[Siren]=Blank();blank();if(LOOKUPVALUE([Numéro SIREN de la société holding tête de groupe française];[Siren]; [Siren]) ;
[Numéro SIREN de la société holding tête de groupe française]&"-F-";
if(CONTAINS(Ta_Base;[Numéro SIREN de la société holding tête de groupe française];[Siren]);
[Siren]& "-M-" 
;BLANK())
        )
       )

 

 

which I also post with an excel file containing the table, and the dax part in powerpivot for members who are interested.

a big thank you to you

 

https://www.dropbox.com/t/7P1YZjrKZJ3TSs3q

 

Philippe

thank you, but problème with french traduction   ,  as ;  and error with  __

 

PhilippeMuniesa_0-1668027138281.png

 

Thank  you

 

philippe

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.