Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a question about table connections in Power BI.
I have a fact table with two ID fields: HCA ID and 710 ID. A row must be either an HCA or a 710 but cant be both. I created a new field Area ID that returns the HCA ID or the 710 ID depending on which applies.
Fact table:
Area Report
HCA ID | 710 ID | Area ID (HCA or 710) | Area Shape (goal) | Area Shape (actual) |
101 | N/A | 101 | A | A |
102 | N/A | 102 | B | B |
N/A | 201 | 201 | D |
|
N/A | 202 | 202 | E |
|
103 | N/A | 103 | C | C |
I have two key tables that indicate the shapes of the HCA IDs and the 710 IDs. I connected ‘Area Report’[HCA ID] to ‘HCA Shape’[HCA ID] (many to one) and connected ‘Area Report’[710 ID] to ‘HCA Shape’[710 ID] (many to one).
Key tables:
HCA Shape
HCA ID | Shape |
101 | A |
102 | B |
103 | C |
710 Shape
710 ID | Shape |
201 | D |
202 | E |
My goal is to Is to create the field Area Shape that puts the HCA shape and 710 shape in a column in the fact table. The issue is that when using the RELATED function, the HCA shape works but the 710 shapes return empty. I think the issue is that I have multiple keys in the fact table but I am not sure how to deal with this.
Thanks in advance for any assistance!
Solved! Go to Solution.
Hi , @apelleti
According to your description, you want to get the shape name from two tables.
My test data is the same as yours and i create relationship like yours:
We can click "New Column" and enter this :
Area Shap = IF( [HCA ID] <> "N/A" , RELATED('HCA Shape'[Shape]) ,RELATED('710 Shape'[Shape]))
Then we can meet your need , the result is as follows:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @apelleti
According to your description, you want to get the shape name from two tables.
My test data is the same as yours and i create relationship like yours:
We can click "New Column" and enter this :
Area Shap = IF( [HCA ID] <> "N/A" , RELATED('HCA Shape'[Shape]) ,RELATED('710 Shape'[Shape]))
Then we can meet your need , the result is as follows:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
I don't know the names of your tables but I think you want something like this:
Proud to be a Super User!