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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
linoybar
Frequent Visitor

Comparative Analysis implementation in Power BI

Hi,

 

I'm trying to create a measure that will use an inactive relationship in order to count number of incidents from MyFactTable that will be influenced by user selecting specific values from units filter which is a column in that inactive table named UnitsTable1.

What I have now is that it works only for totals but when I make a selection in a filter I get blank.

 

The active table is called UnitsTable.

 

Here is my dax:

 

Measure = CALCULATE(counta(MyFactTable[IncidentKey],

                   USERRELATIONSHIP(MyFactTable[IncidentKey], MyMappingTable[IncidentKey],

                   USERRELATIONSHIP(MyMappingTable[UnitKey], UnitsTable1[UnitKey])

)

 

 

At the end the purpose is to show in a single chart comparison between number of incidents of UnitA vs number of incidents of UnitB+UnitC, for example.

So I've uploaded the UnitsTable twice into my Tabular model. They have UnitColumn which I put as filters. 

So then the user will choose UnitA from UnitColumn from UnitsTable, and Unit B and Unit C from UnitColumn from UnitsTable1, 

and then the chart needs to show 2 lines - one for number of incidents for UnitA, and second for number of incidents for UnitB+C.

 

Please help 🙂

 

Thanx!

P.S. To clarify my initial issue, here is the best explanation of what I'm trying to achieve:
https://community.powerbi.com/t5/Desktop/Alternate-states-functionality/td-p/238984

3 REPLIES 3
Anonymous
Not applicable

HI @linoybar,

 

AFAIK, for calculate function, it use 'and' logic to link each filters.

So if you put multiple filters in it, it will try to find out records who achieve each conditions at same time. 

 

I think this is the reason of blank calculation result.

 

Maybe you can try to split your formula as two calculation and summary them get total value:

Measure =
CALCULATE (
    COUNTA ( MyFactTable[IncidentKey] ),
    USERELATIONSHIP ( MyFactTable[IncidentKey], MyMappingTable[IncidentKey] )
)
    + CALCULATE (
        COUNTA ( MyFactTable[IncidentKey] ),
        USERELATIONSHIP ( MyFactTable[IncidentKey], UnitsTable1[UnitKey] )
    )

 

Reference link:

Order of Evaluation in CALCULATE Parameters

 

Regards,

Xiaoxin Sheng

Hi @Anonymous,

 

Thanks for your reply.

In my model MyFactTable is connected to MyMappingTable, and MyMappingTable is connected to UnitsTable1.

As you can see, there is no straight connection between MyFactTable  and MyMappingTable.

Only the connection between MyMappingTable and Unitstable1 is inactive - this is the one I'm trying to activate using USERRELATIONSHIP.

So maybe the part of

USERELATIONSHIP ( MyFactTable[IncidentKey], MyMappingTable[IncidentKey]

is unnecessary since it's always activated anyway.

I tried either ways, but nothing worked...

Anonymous
Not applicable

HI @linoybar,

 

Nope, I think it is impossible.

 

USERELATIONSHIP seems only works on two table who contains direct relationship, I don't think you can nested multiple functions to enable relationship for other tables.

 

Marco also mentioned for USERELATIONSHIP function , you can take a look at below blog to know more about it.

USERELATIONSHIP in Calculated Columns


Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors