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
olegkazanskyi
Helper II
Helper II

DAX for USERRELATIONSHIP with 2 DIM tables and waterfall structure

Hello,

I have this schema with 2 inactive relationships and 1 active.

olegkazanskyi_1-1681761421331.png

 

 

This is a small part of a more complex model as an example for simplicity of explanation of the issue I am trying to solve.

 

The PBIX is also attached.

Link with the PBIX 

 

The Activity table can have blanks for the workspace ID or for the Report ID, depending on the activities.

I want to get a matrix with workspaces and reports combined, but I can't find a way to make it work.
No Report values show up under the workspace hierarchy.

olegkazanskyi_0-1681764721624.png

 

 

Here is my formula.

Count_Activities =
SWITCH (
    TRUE (),
     ISFILTERED ( report ) && ISFILTERED ( workspaces ),
        CALCULATE (
            COUNTROWS ( Activities ),
            USERELATIONSHIP ( report[id], Activities[Report ID] )
        ),
    ISFILTERED ( workspaces ),
        CALCULATE (
            COUNTROWS ( Activities ),
            USERELATIONSHIP ( workspaces[id], Activities[Workspace ID] )
        )
)

 

I can make it work for reports and workspaces on different visuals, but not when they are together.

2 REPLIES 2
amitchandak
Super User
Super User

@olegkazanskyi , you should merge report and workspace tables into one dimension and use that to join and filter Activities

 

You can use power query merge

 https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak , 
I may need a little more explanation if I may ask.
When I merge the two tables, as a result, I get many-to-many relations between  workspace_ID as there are duplicates in the new table now.
I can't make a relation solely by the report_id because of the Activity table structure.  A single activity can be related to the report or relevant only to the workspace.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors