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

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

Reply
Riyaz999
Helper I
Helper I

Creating a table in DAX with filtered by page filter and using inactive relationship

I have a complication model that ultimately has an ambiguous relationship back to my Report table.  I was able to make one path an inactive relationship but I am having trouble creating a dax table that uses the inactive relationship in conjunction with a page level filter.

Report

ReportIdReportName
1Report1
2Report2

 

Metric

MetricIdMetricName
1Metric1
2Metric2
3Metric3
4Metric4

 

Station

StationIdStationName
1Station1
2Station2
3Station3

 

ReportMetric

ReportIdMetricIdOrdinal
111
123
132
222
233
241

 

ReportStation

ReportIdStationIdOrdinal
121
112
133
212
221

 

FACT

DateTimeMetricNameStationNameValue
Jan 1, 202512:00Metric1Station1x1
Jan 1, 202512:00Metric2Station1x2
Jan 1, 202512:00Metric3Station1x3
Jan 1, 202512:00Metric1Station2x4
Jan 1, 202512:00Metric2Station2x5
Jan 1, 202512:00Metric3Station2x6
Jan 1, 202512:00Metric1Station3x7
Jan 1, 202512:00Metric2Station3x8
Jan 1, 202512:00Metric3Station3x9
Jan 1, 202512:00Metric2Station1x10
Jan 1, 202512:00Metric3Station1x11
Jan 1, 202512:00Metric4Station1x12
Jan 1, 202512:00Metric2Station2x13
Jan 1, 202512:00Metric3Station2x14
Jan 1, 202512:00Metric4Station2x15

 

Relationships

Metric 1 to Many ReportMetric

Report 1 to Many ReportMetric

Station 1 to Manay ReportStation

Report 1 to Many ReportStation

 

Since the ReportMetric table a many to many relationship to the FACT table and likewise the ReportStation (MetricIds 2 & 3 appear multiple times on both sides of the relationship), I need to create a relationship in between these two tables.  This was done with a dax table.  It also makes it easier to join my FACT table as I have included the MetricName field.

 
ReportMetricFilteredbySingleRpt =
CALCULATETABLE(
    ADDCOLUMNS(
        'ReportMetric',
        "MetricName", LOOKUPVALUE('Metric'[MetricName], 'Metric'[MetricId],'ReportMetric'[MetricId])
    ),
    FILTER(ReportMetric, 'ReportMetric'[ReportId] = [mSeletectedReportId])
)

 

I also used the following measures:

mSeletectedReportId = CALCULATE(MAX('Report'[ReportId]), FILTER('Report', 'Report'[ReportName] = [mSeletectedReport]))
mSeletectedReport = SELECTEDVALUE('Report'[ReportName])
 
as well as page level filters on each report page.  i.e., on page 1 I set the filter to Report1 and on page 2 I set it to Report2.  
 
Relationships
Metric 1 to Many ReportMetricFilteredbySingleRpt
Report 1 to Many ReportMetricFilteredbySingleRpt
ReportMetricFilteredbySingleRpt Many to Many to FACT
 
I had to make this last relationship many to many for power bi to accept it but since I have a page filter that limits the results, I don't actually have a many to many relationship at the data level.
 
This solution works for the Metrics and I can pull in the ordinal value for a given Report to Metric relationship such that my Metrics appear on the visuals in question in the prescribed order.
 
The issue is that I can't apply the same logic on the ReportStation side because it results in two paths to Report (ambiguous path to Reports error)

 

i.e., 

Station 1 to Many ReportStationFilteredbySingleRpt
Report 1 to Many ReportStationFilteredbySingleRpt
ReportStationFilteredbySingleRpt Many to Many to FACT
 
I have tried many different approaches in DAX to create a table for ReportStationFilteredbySingleReport but to no avail and the result is that I have Stations appearing in report where I don't want to see them as well as duplicate entries where a Station appears more than once.
 
One additional point to mention, is to resolve the duplicate paths to Report, I had to make the relationship from ReportStationFilteredbyReport to Report an inactive relationship.
 
Essentially, I need to use the inactive relationship:
CALCULATETABLE(
    'Report',
    USERELATIONSHIP('Report'[ReportId], 'ReportStation'[ReportId])
)
 
noting that I have the page filter for 'Report'[ReportName] set to Report1 on tab/page1
 
as well as filter the results to only include ReportId = 1 on page 1.
VAR RptId = LOOKUPVALUE('Report'[ReportId], 'Report'[ReportName], SELECTEDVALUE('Report'[ReportName]))
RETURN
FILTER('ReportStation',
   'ReportStation'[Reportid]=RptId
)
 
If I hardcode RptId = 1, it works but then I can't use this measure on page 2.  I actually have 10 report pages with 20+ Metrics and 10 Stations.  There is a lot of overlap in terms of which Stations and Metric appear on which reports and the order is not always the same. 
 
I am looking for help with a generic dax statement for ReportStationFilteredbyReport to use the page level filter value and the inactive relationship to return a list of Stations that would appear on the given report page and the order, given by the ordinal field, in which they would appear.
 
Thanks in advance,
1 ACCEPTED SOLUTION

Hello @Riyaz999 ,

Thanks for your patience and for trying out different solutions. I really appreciate your effort.

Since the circular dependency appears to be caused by the calculated table referencing the Report table, you might want to move the logic to the measure level instead.

Consider using USERELATIONSHIP() dynamically within a measure and applying it as a visual level filter. This approach can help you avoid creating a separate filtered table and prevent the circular reference issue.

Let me know if this helps. I'm happy to keep working on it with you.

 

Regards,
Yugandhar.

View solution in original post

13 REPLIES 13
V-yubandi-msft
Community Support
Community Support

Hi @Riyaz999 ,

I wanted to check in regarding your issue. Has it been resolved, or do you need any further information. Let me know if you’d like more details.

 

Thanks.

V-yubandi-msft
Community Support
Community Support

Hi @Riyaz999 ,
May I know if your issue has been resolved, or if you need any additional assistance? Please feel free to let us know.

 

Thanks.

V-yubandi-msft
Community Support
Community Support

Hi @Riyaz999 ,

Thank you for reaching out to the Microsoft Fabric Community. The ambiguity occurs because Power BI recognizes multiple paths from FACT to Report, particularly when both ReportStationFilteredbySingleRpt and ReportMetricFilteredbySingleRpt are linked to Report. Even if one path is inactive, using both in the same visual or calculation can still cause ambiguity errors.

To resolve this, you can try

1. Apply USERELATIONSHIP() within CALCULATE() to activate the necessary relationship.

2. Avoid joining both filtered tables directly to Report in the same visual or measure.

3. Separate the logic for ReportStationFilteredbySingleRpt using a calculated table that follows the page-level filter and activates the appropriate relationship.

 

Helpful Reference: 
Active vs inactive relationship guidance - Power BI | Microsoft Learn
USERELATIONSHIP function (DAX) - DAX | Microsoft Learn

Regards,
Yugandhar.

Hi @V-yubandi-msft,

I guess my issue is I don't know how to resolve my issue using your suggestion option #1.  My latest attempt is:

ReportStationFilteredbySingleRpt =
CALCULATETABLE(
    CALCULATETABLE(
        ADDCOLUMNS(
            'ReportStation',
            "StationName", LOOKUPVALUE('Station'[StationName], 'Station'[StationId],'ReportStation'[StationId])
        ),
        USERELATIONSHIP('ReportStation'[ReportId], 'Report'[ReportId]),
    ),
    'ReportStation'[ReportId] = [mSeletectedReportId]
)
 
The version that returns the duplicates is:
ReportStationFilteredbySingleRpt =
CALCULATETABLE(
    ADDCOLUMNS(
        'ReportStation',
        "StationName", LOOKUPVALUE('Station'[StationName], 'Station'[StationId],'ReportStation'[StationId])
    ),
    FILTER('ReportStation', 'ReportStation'[ReportId] = [mSeletectedReportId])
)

Hi @Riyaz999 ,

Thank you for sharing your latest attempt you're very close. The main issue is that you're still filtering  ReportStation [ReportId] directly, which bypasses the inactive relationship you're aiming to activate with USERELATIONSHIP(). Additionally, it's not necessary to nest CALCULATETABLE() in this case.

Try This Version

ReportStationFilteredbySingleRpt =
CALCULATETABLE(
   ADDCOLUMNS(
       'ReportStation',
       "StationName", LOOKUPVALUE('Station'[StationName], 'Station'[StationId], 'ReportStation'[StationId])
   ),
   USERELATIONSHIP('ReportStation'[ReportId], 'Report'[ReportId]),
   'Report'[ReportName] = SELECTEDVALUE('Report'[ReportName])
)


Please give it a try and let me know how it turns out.

Regards,
Yugandhar.

Hello Yugandhar,

thanks for your response.  Unfortunately, this didn't work for me.  I got the following circular dependency error:

Riyaz999_1-1756143949117.png

It may be useful to see my response to FBergamaschi as to why this circular dependency exists:
https://community.fabric.microsoft.com/t5/Desktop/Creating-a-table-in-DAX-with-filtered-by-page-filt...

 

Thanks in advance,

R

 

Thanks again for the detailed follow up and for linking your explanation to FBergamaschi that context is super helpful.

Circular dependency errors like the one you're seeing often occur when a calculated table references filters or relationships that indirectly depend on itself. In your case, using  Report'[Report Name]= Selectedvalue.. inside a calculated table tied to Report  via an inactive relationship can trigger that loop.

 

Suggested pattern to try

While I haven’t been able to test this DAX directly, here’s a pattern that may help break the dependency.

VAR RptId = CALCULATE(MAX('Report'[ReportId]))
RETURN
CALCULATETABLE(
    ADDCOLUMNS(
        'ReportStation',
        "StationName", LOOKUPVALUE('Station'[StationName], 'Station'[StationId], 'ReportStation'[StationId]),
        "Ordinal", 'ReportStation'[Ordinal]
    ),
    USERELATIONSHIP('ReportStation'[ReportId], 'Report'[ReportId]),
    'ReportStation'[ReportId] = RptId
)

 

This version avoids referencing Report Name  directly and instead uses a resolved Report ID  variable, which may help avoid the circular dependency.

 

Hope this helps..

Hi again @V-yubandi-msft,
Thanks so much for the suggestion.  Unfortunately, I still get the circular dependency with this approach.

Regards,

Hello @Riyaz999 ,

Thanks for your patience and for trying out different solutions. I really appreciate your effort.

Since the circular dependency appears to be caused by the calculated table referencing the Report table, you might want to move the logic to the measure level instead.

Consider using USERELATIONSHIP() dynamically within a measure and applying it as a visual level filter. This approach can help you avoid creating a separate filtered table and prevent the circular reference issue.

Let me know if this helps. I'm happy to keep working on it with you.

 

Regards,
Yugandhar.

Hi @Riyaz999 ,
Has your issue been resolved, or do you need any additional information to move forward?

Thanks

P.S. I think it is easier to visualize looking at my response to: FBergamaschi.

FBergamaschi
Solution Sage
Solution Sage

Thanks for the detailed post

 

Can you show images of the issue and what you want to achieve? Images help understand faster

 

Thanks

Model:

Riyaz999_0-1755885085249.png

Riyaz999_1-1755885295110.png

Riyaz999_3-1755885882571.png

Riyaz999_2-1755885325640.png

Riyaz999_4-1755885913756.png

In matrix visuals above, which appear on different report pages, I have the following:

Rows:

StationName (ReportStationFilteredbySingleRpt)

Date (FACT)

Time (FACT)

 

Columns:

MetricName (ReportMetricFilteredbySingleRpt)

 

Values:

mRoundedValue

 

mRoundedValue =
VAR Metric = SELECTEDVALUE('FACT'[Metric])
VAR Precision = LOOKUPVALUE('Metric'[Precision], 'Metric'[MetricName], Metric)
VAR PrecFormat = IF(VALUE(Precision) > 0, "." & REPT("0", Precision), "")

RETURN IF(ISBLANK(Precision), 'FACT'[Value], FORMAT('FACT'[Value], "0" & PrecFormat))
 

MetricName doesn't have any duplication or undesired Metrics shown on each visual because I have an active relationship between ReportMetricFilteredbySingleReport and Report.  Since there is an inactive relationship between ReportStationFilteredbySingleReport and Report, I need to Calculate that table by both applying the page level filter for the selected report and utilizing the use of that inactive relationship between ReportStationFilteredbySingleReport and Report.

I hope this clarifies. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.