Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Dear All, I need help about relationship in direct query mode. Basically, I have two table. Here my illustration of my issue.
Table 1.
ID | ID Student | Name Student | CovidSymptoms |
1 | 1111 | A | Fever |
2 | 2222 | B | Cough |
3 | 3333 | C | Loss of smell |
4 | 4444 | D | Fatigue |
5 | 5555 | E | Fever |
Table 2.
ID | ScreenerID | ID Student | AntigenResult |
1 | 2 | 2222 | Positive |
2 | 5 | 5555 | Negative |
3 | 3 | 3333 | Not Tested |
I Try to create relationship between " ID" in table 1 and "ScreenerID" in table 2 because the value have same unique value. I create "one to one" Cardinality" and cross filter direction "Both"(Note: Sigle cannot be apply). But the result I got is messy, Here my result when I try to create a table visual:
ID Student | Name Student | CovidSymptoms | Antigen Result |
1111 | A | Fever | |
1111 | A | Fever | Positive |
1111 | A | Fever | Negative |
1111 | A | Fever | Not Tested |
2222 | B | Cough | |
2222 | B | Cough | Positive |
2222 | B | Cough | Negative |
2222 | B | Cough | Not Tested |
3333 | C | Loss of Smell | |
3333 | C | Loss of Smell | Positive |
3333 | C | Loss of Smell | Negative |
3333 | C | Loss of Smell | Not Tested |
4444 | D | Fatigue | |
4444 | D | Fatigue | Positive |
4444 | D | Fatigue | Negative |
4444 | D | Fatigue | Not Tested |
5555 | E | Fever | |
5555 | E | Fever | Positive |
5555 | E | Fever | Negative |
5555 | E | Fever | Not Tested |
Basically, Every ID have 4 value even ID that not consist in the table 2.
I Hope ther result will be like this :
ID Student | Name Student | CovidSymptoms | Antigen Result |
1111 | A | Fever | |
2222 | B | Cough | Positive |
3333 | C | Loss of Smell | Not Tested |
4444 | D | Fatigue | |
5555 | E | Fever | Negative |
Anyone can help, I am new with power bi :). Anyhelp will be really appreaciated.
Thanks.
Solved! Go to Solution.
@TaufikMaggangka , Make it one to Many and bi-directional and try. Or you need to have a common table for
ID | ID Student | Name |
And use that.
This requires a Join and not relationship.
In Power Query Do a LeftJoin:
Table 1 LeftJoin Table2
Also, if you can explain a bit more on unique columns in both the tables, it would be helpful.
Hi @Anonymous ,
Unique values is ID on this case. the unique value have same value for each data registered.
Basically, we have 2 form to input the data on the database. the first form is about screener table, the purpose of this table to screen student which have covid symptoms. the ID is unique value that fill automatically. the second form is to submit antigen result for each student that have screen. the id on the first table and second table have same unique value. it is why I thought it can be done with relationship.
Any more explananation about left join table on my cases will be really appreciate. I am not resolve this issue yet.
@TaufikMaggangka , Make it one to Many and bi-directional and try. Or you need to have a common table for
ID | ID Student | Name |
And use that.
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |