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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
esanning
Regular Visitor

Averaging Data on Partially Related Tables

I have three tables - Application, CreditBureauResults, and FundedLoan. The table relationships are as such (Image in supporting images):

  • Application - 1:* - CreditBureauResults   -   (ApplicationNumber = ApplicationNumber)
  • Application - 1:1 - FundedLoan   -   (ApplicationNumber = ApplicationNumber)

Not every Application becomes a FundedLoan.

 

Issue: When trying to report on FundedLoans for a period (Monthly) I am trying to report the average credit score for that month (credit score is stored in the CreditBureauResults table). Within Power BI when I create this it actually just averages ALL credit scores within the CreditBureauResults table ignoring that I'm attempting to show records from a certain month. 

Also in the supporting image you can see that the table has an additional blank row, I believe all this is telling me that because there are Application's that don't have a FundedLoan record that it doesn't understand the relationship between these two tables.

 

What I've tried: Various DAX queries (below), as well as creating my own relationship between FundedLoan and CreditBureauResults table (ApplicationNumber column since that is the column that would be the same between a FundedLoan and CreditBueauResults records). My first attempt at a aggregated table using Power Query was also not successful, it did not change the end result.

  • AVERAGEX(GROUPBY(CreditBureauResult, 'CreditBureauResult'[ApplicationNumber], "AverageScore", AVERAGEX(CURRENTGROUP(), CreditBureauResult[Score])), [AverageScore])
  • AVERAGEX(SUMMARIZE(CreditBureauResult, CreditBureauResult[ApplicationNumber], CreditBureauResult[Score]), CreditBureauResult[Score])

Supporting images:

esanning_1-1658956298656.png

esanning_0-1658951806652.png


-= EDIT 2022-July-29 =-

Link to example tables with data: https://drive.google.com/drive/folders/1nN5Snhz4TQuSQz59kcfYO6NLaej_wIHs?usp=sharing

 

Here is what the example data would look like if it was averaging correctly:

esanning_0-1659102013278.png

 

 

Thank you!

1 ACCEPTED SOLUTION

Your data model needs some love.

 

Either specify the application as the main dimension and use the other tables as facts

 

lbendlin_0-1659108005353.png

 

Or fold the FundedLoan table into the Application table.  You can leave the ContractDate and LoanNumber blank for applications that aren't funded yet.

 

 Your quest to show average score per month is potentially not based on any actual data in your fact tables, so you need to create measures for that which transfers the filter context via TREATAS

 

Generally you want to add a proper calendar table. 

 

See attached for a sample implementation.

View solution in original post

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @esanning ,

 

Is your problem solved. If yes, please mark it as the correct answer so that more can find it, if not, please add more detail about your question so that others can help you better.

 

Best Regards

Community Support Team _ chenwu zhu

lbendlin
Super User
Super User

Thank you for the concise description. Please provide sanitized sample data that fully covers your issue. I cannot help you without usable sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. I cannot use screenshots of your source data.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

I have edited the original post with the additional data requested. Thank you!

Your data model needs some love.

 

Either specify the application as the main dimension and use the other tables as facts

 

lbendlin_0-1659108005353.png

 

Or fold the FundedLoan table into the Application table.  You can leave the ContractDate and LoanNumber blank for applications that aren't funded yet.

 

 Your quest to show average score per month is potentially not based on any actual data in your fact tables, so you need to create measures for that which transfers the filter context via TREATAS

 

Generally you want to add a proper calendar table. 

 

See attached for a sample implementation.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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