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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mkpado
Helper I
Helper I

DAX Horizontal Lookoup

I am looking to write a formula in DAX that will look with a records and deterime if a value exists in any of the columns associated with that record. For example lets say I have 5 records with 3 Checks that I am running accross each record. If the word "Error" appears in any of the columns within a record, a fourth column (Pass / Fail) should read "Fail" if not it should be read "Pass". See table below for a visual.

 

hlookup.JPG

In excel I would write this formula with a match funcction (i.e. =if(match("Error",Range,0)>0,"Fail","Pass")) but there are no equivalent funtions in DAX that I can find. The only function that I have found that performs a lookup is LOOKUPVALUE but form what I can tell this function only looks up vertically in a column and not accross a row (i.e. record).

 

Please let me know if anyone has a workaround for this.

1 ACCEPTED SOLUTION

There should be no use of a single |

 

The double || is the operator for OR in logical tests.  There is a function called OR (..) that takes parameters.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @mkpado

 

Please add the following calculated column to your table

 

Pass / Fail = 
    IF (
        'Table1'[Check 1] = "Error" ||  
        'Table1'[Check 2] = "Error" || 
        'Table1'[Check 2] = "Error" , 
        -- THEN --
        "Fail" , 
        -- ELSE --
        "Pass" 
        )  
	

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Is there a difference in using a single | vs two || to signal an OR statement in Dax?

There should be no use of a single |

 

The double || is the operator for OR in logical tests.  There is a function called OR (..) that takes parameters.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.