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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Quartarolo
Regular Visitor

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
AlB
Super User
Super User

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
AlB
Super User
Super User

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

NamishB
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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