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
BlueRanger
Frequent Visitor

Error Using RELATED with CALCULATE

Hello,

 

I am running into an error when using the related function and would appreciate any help!

 

Here is a snapshot of my data model:

 

BlueRanger_0-1717004372804.png

 

I am running a count on the invoice lines table and using calculate to filter the count using the connecting dimension tables: item and invoice header.

 

Here is the DAX I am using for my measure:

BlueRanger_2-1717004672564.png

 

As you can see, I am running into issues with the RELATED function which is causing my error. Is there a way to calculate a count on my fact table using filters from other dimension tables it is connected to?

Thanks!

1 ACCEPTED SOLUTION

@Greg_Deckler 

Greg, thanks again for your help! I was able to solve the issue by changing my DAX calculation. Because of the direction of the relationships, RELATED was not needed.

View solution in original post

4 REPLIES 4
BlueRanger
Frequent Visitor

Thanks @Greg_Deckler ! What would you recommend as a solution? 

@BlueRanger Without something to test it's difficult to know for certain. One option would be to change the relationship filter directin to Both. Alternatively, you could perhaps use CALCULATE and CROSSFILTER to get the value instead of RELATED. Or, you could use LOOKUPVALUE or MAXX( FILTER( to also lookup the value instead of RELATED. If none of that helps...

 

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Greg, thanks again for your help! I was able to solve the issue by changing my DAX calculation. Because of the direction of the relationships, RELATED was not needed.

Greg_Deckler
Community Champion
Community Champion

@BlueRanger For one, your relationships aren't pointed in the right direction for that to work.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.