cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Highlighted
Super User II
Super User II

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
Highlighted
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

Highlighted

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!

Highlighted
Super User II
Super User II

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors