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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
juleshelen
New Member

DAX to compare data in different tables and return a response

Hi 

I have a data table that contains responses from a set of audit questions which have been answered multiple times by different users with yes/no answers. I then have a data table that has the expected correct answer for each question (examples below)

I want to be able to create a column in the audit data table that compares the response against the "expected response" and then returns either a true or false result dependent on if it matches. 

I am struggling to write the DAX for this can anyone help?

AUDIT DATA

questionaudit response
have all staff members had trainingyes
have all volunteers had trainingno
are all doors fitted with external locksno
have all staff members had trainingno
have all volunteers had trainingyes

Expected responses

questionexpected response
have all staff members had trainingyes
have all volunteers had trainingyes
are all doors fitted with external locksyes
1 ACCEPTED SOLUTION
BabyYoda
Frequent Visitor

Response Matches Expected Response = Var GetExpectedResponse = LOOKUPVALUE('Expected Response'[Expected Response], 'Expected Response'[Question],'Audit Data'[Question])
RETURN IF(GetExpectedResponse='Audit Data'[Audit Response], TRUE(), FALSE())

View solution in original post

3 REPLIES 3
BabyYoda
Frequent Visitor

Response Matches Expected Response = Var GetExpectedResponse = LOOKUPVALUE('Expected Response'[Expected Response], 'Expected Response'[Question],'Audit Data'[Question])
RETURN IF(GetExpectedResponse='Audit Data'[Audit Response], TRUE(), FALSE())

thank you that works perfectly

I wouldn't solve this with DAX.  I would join the two tables by the Question field.

 

Then, in Table, bring over Responder Name, Question and Audit Response from Audit table and Expected response from the Expected Response table.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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