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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Tob_P
Helper V
Helper V

Column Blank and Not Blank

Hi,

 

I'm looking to create a customer column based on two columns in the same table.

If Column 1 contains a number (3 digits) and Column 2 is contains the same number , then I want to label it 'Direct'. If the digits in either column do not match, then label it 'Indirect'. The caveat is that on occassion, there may be data in column 1, but no data in column 2.

 

Any help would be appreciated!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Tob_P 
Please refer to attached file with the solution

1.png

Output2 = 
IF ( 
    'Table'[Col 1] IN ALLNOBLANKROW ( 'Table'[Col 2] ),
    IF ( 
        'Table'[Col 1] = 'Table'[Col 2]
            || 'Table'[Col 2] = BLANK ( ),
            "Direct",
            "Indirect"
    )
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @Tob_P 
Please refer to attached file with the solution

1.png

Output2 = 
IF ( 
    'Table'[Col 1] IN ALLNOBLANKROW ( 'Table'[Col 2] ),
    IF ( 
        'Table'[Col 1] = 'Table'[Col 2]
            || 'Table'[Col 2] = BLANK ( ),
            "Direct",
            "Indirect"
    )
)
Tob_P
Helper V
Helper V

Thanks @Anonymous 

 

Apologies - I did not explain this well at all.

 

Col 1Col 2Output
222222Direct
222225Indirect
222227Indirect
222 Direct
227222Indirect
 222Indirect
222222Direct

 

Working on the basis of code 222...

  • if columns 1 & 2 match, then direct
  • if column 1 has code 222 and a different code in column 2, then indirect
  • if column 1 has code 222 and column 2 is blank, then direct
  • if column 2 has no code and column 2 is populated, then indirect.
Anonymous
Not applicable

Ok. no probs. Try this :

TEST =
if(and(ISBLANK(Feuil6[col2]), not(ISBLANK(Feuil6[col1]))),"Direct",
    if(and(ISBLANK(Feuil6[col1]), not(ISBLANK(Feuil6[col2]))),"Indirect",
    if(Feuil6[col1]=Feuil6[col2],"Direct","Indirect")
    )
)
Anonymous
Not applicable

 

 

TEST =
if(ISBLANK(Feuil6[col2]),"You did not say what uou whant to put :)",
    if(Feuil6[col1]=Feuil6[col2],"Direct","Indirect")
)
JamesFr06_0-1666862551070.png

 

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.