The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
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:
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!
Solved! Go to 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.
@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.
@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.
@BlueRanger For one, your relationships aren't pointed in the right direction for that to work.
User | Count |
---|---|
27 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
7 | |
7 |