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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Bls-80
Frequent Visitor

Power BI Table report removing rows when columns from related tables have no corresponding value

I'm having issues creating a table report in power bi.  Scenario: We have a table of inspections in one report.  From this zero to multiple actions can be added to another (there is a corresponding ID to create a relationship), they can also add zero to multiple requests to another table, and from these requests can also create zero to multiple actions.  I have a model with a relationship between the three tables.  I'm trying to create a report which shows certain details from all three tables so corresponding actions and requests can be tracked more easily by teams. As soon as I add values from the actions and/or requests tables into the visual, any inspection that doesn't have a corresponding action and/or request disappears.  I need these to be visible in the report (with blanks in the corresponding columns) as well.  Is this possible?

 

Bls80_0-1724772951418.png

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Bls-80,

Thank you for your additional information.

 

Please use following dax code to create a calcualted table as shown below:

CombinedTable2 = 
VAR AllInspectionIDs =
   SELECTCOLUMNS(
       'Inspection',
       "Inspection", 'Inspection'[InspectionID]
   )
VAR InspectionInRequest =
   SELECTCOLUMNS(
       'Requests',
       "Inspection", 'Requests'[RelatedID]
   )
VAR InspectionInAction =
   SELECTCOLUMNS(
       'Actions',
       "Inspection", 'Actions'[RelatedID]
   )
VAR InspectionNotInRequestOrAction =
   EXCEPT(
       AllInspectionIDs,
       UNION(
           InspectionInRequest,
           InspectionInAction
       )
   )
VAR InspectionsWithBlanks =
   ADDCOLUMNS(
       InspectionNotInRequestOrAction,
       "Request", BLANK(),
       "Action", BLANK()
   )
RETURN
FILTER(
   UNION(
       InspectionsWithBlanks,
       SELECTCOLUMNS(
           'Requests',
           "Inspection", IF(ISBLANK(LOOKUPVALUE(Actions[RelatedID], Actions[RelatedID], Requests[RequestID])),[RelatedID],BLANK()),
           "Request", IF(ISBLANK(LOOKUPVALUE(Actions[RelatedID], Actions[RelatedID], Requests[RequestID])),[RequestID],BLANK()),
           "Action", BLANK()
       ),
       SELECTCOLUMNS(
           'Actions',
           "Inspection", IF(ISBLANK(LOOKUPVALUE('Actions'[RelatedID], 'Actions'[RelatedID], RELATED(Requests[RequestID]))),'Actions'[RelatedID],LOOKUPVALUE(Requests[RelatedID],Requests[RequestID],'Actions'[RelatedID])),
           "Request", LOOKUPVALUE(Requests[RequestID],Requests[RequestID],'Actions'[RelatedID]),
           "Action", [ActionID]
       )
   ),NOT(ISBLANK([Inspection]))
)

Result for your reference:

vyajiewanmsft_1-1725008154774.png

 

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Bls-80
Frequent Visitor

hi @Anonymous, sorry for the late response.  See below. If there was more data in my made-up dataset there would be a 1 to many relationship between inspections and  Requests (from each inspection you can create many requests). Re my output - human error - there should only be one output for Inspection 3! Sorry.  Appreciate any advice/insight you could provide. Thanks

Bls80_0-1724961285165.png

 

Anonymous
Not applicable

Hi @Bls-80,

Thank you for your additional information.

 

Please use following dax code to create a calcualted table as shown below:

CombinedTable2 = 
VAR AllInspectionIDs =
   SELECTCOLUMNS(
       'Inspection',
       "Inspection", 'Inspection'[InspectionID]
   )
VAR InspectionInRequest =
   SELECTCOLUMNS(
       'Requests',
       "Inspection", 'Requests'[RelatedID]
   )
VAR InspectionInAction =
   SELECTCOLUMNS(
       'Actions',
       "Inspection", 'Actions'[RelatedID]
   )
VAR InspectionNotInRequestOrAction =
   EXCEPT(
       AllInspectionIDs,
       UNION(
           InspectionInRequest,
           InspectionInAction
       )
   )
VAR InspectionsWithBlanks =
   ADDCOLUMNS(
       InspectionNotInRequestOrAction,
       "Request", BLANK(),
       "Action", BLANK()
   )
RETURN
FILTER(
   UNION(
       InspectionsWithBlanks,
       SELECTCOLUMNS(
           'Requests',
           "Inspection", IF(ISBLANK(LOOKUPVALUE(Actions[RelatedID], Actions[RelatedID], Requests[RequestID])),[RelatedID],BLANK()),
           "Request", IF(ISBLANK(LOOKUPVALUE(Actions[RelatedID], Actions[RelatedID], Requests[RequestID])),[RequestID],BLANK()),
           "Action", BLANK()
       ),
       SELECTCOLUMNS(
           'Actions',
           "Inspection", IF(ISBLANK(LOOKUPVALUE('Actions'[RelatedID], 'Actions'[RelatedID], RELATED(Requests[RequestID]))),'Actions'[RelatedID],LOOKUPVALUE(Requests[RelatedID],Requests[RequestID],'Actions'[RelatedID])),
           "Request", LOOKUPVALUE(Requests[RequestID],Requests[RequestID],'Actions'[RelatedID]),
           "Action", [ActionID]
       )
   ),NOT(ISBLANK([Inspection]))
)

Result for your reference:

vyajiewanmsft_1-1725008154774.png

 

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank you @Anonymous . I'll try that this weekend and accept. I had thought the relationship would have been enough so was on completely the wrong path. It will take me a while to break this down and understand but I really appreciate your help. 

Anonymous
Not applicable

Hi @Bls-80 ,

 

Since the relatedid of the Action table is in both inspection and request, what is the relationship between the three tables?

 

Also, in your output, why does inspection id 3 have three duplicate rows?

 

Please feel free to reply for better understanding and testing.

 

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.