cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

How to show missing values from a reference based on a key from an answer

Hi Everyone.

 

I'm kind of new to Power BI, but i've been working hard on a report these days.

 

My problem is: I have a fix reference table and an answers table (based on a key) shown bellow

 

'Reference'

 

Fixed Answers

A

B

C

D

E

 

'Answers'

Key

Answer

1

A

1

C

2

A

2

D

3

B

 

What I'm trying to do is get the following table:

 

'Final I want'

Key

Missing answer

1

B,D,E

2

B,C,E

3

A,C,D,E

 

Either on separated rows or in the same cell works for me, but I just can't seem to get it...

 

I even get a list of missing values, but not related to the key. what I got was:

 

'Table I got'

Missing Answers

E

 

Can anyone help?

1 ACCEPTED SOLUTION
Super User III
Super User III

Hi @Quartarolo 

0. Change the name of the Reference[Fixed Answers] column to Reference[Answer]

1. Place Answers[Key] in the a table visual

2. Create this measure and place it on the visual

Missing answer =
VAR answers_ =
    DISTINCT ( Answers[Answer] )
VAR refAnswers_ =
    ALL ( Reference[Answer] )
VAR missing_ =
    EXCEPT ( refAnswers_, answers_ )
RETURN
    CONCATENATEX ( missing_, [Answer], ", " )

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

3 REPLIES 3
Super User III
Super User III

Hi @Quartarolo 

0. Change the name of the Reference[Fixed Answers] column to Reference[Answer]

1. Place Answers[Key] in the a table visual

2. Create this measure and place it on the visual

Missing answer =
VAR answers_ =
    DISTINCT ( Answers[Answer] )
VAR refAnswers_ =
    ALL ( Reference[Answer] )
VAR missing_ =
    EXCEPT ( refAnswers_, answers_ )
RETURN
    CONCATENATEX ( missing_, [Answer], ", " )

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

Post Prodigy
Post Prodigy

Hi @Quartarolo  - Sorry your question is not clear to me.

Can you please explain what's the logic applied for 'Final I want' ?

 

All i understand is There is a reference table with values A to E

'Answers' table? What does this mean? How A and C has the same key value 1? And A and D has 2

Totally confusing to me

 

Please be more elaborative.

 

Cheers,

-Namish B

Sorry, it's my first post! I'll elaborate more:

 

the 'Answers' table is from a form filled by my costumer. In there, they choose a location (the 'key" column), and choose a safety item that was installed (those are the answers).

 

The thing is that not all items are installed at the same time, so there is more than one row for each location.

 

I'll rewritte the tables:

 

'Reference'

Safety Item

A

B

C

D

E

 

'Costumer Answers'

Key (Location)

Answer (Safety Item installed)

1

A

1

C

2

A

2

D

3

B

 

So what i want to know is "which items haven't been installed on each location"

 

If it's still confusing, just let me know, and thanks for the help!

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors