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

Conditional Aggregation with 2 tables and inactive relationships

I have a model from which I need to determine the number of new students in a Fall term who have pledged (PledgedInd=1) in the Spring term immediately after the Fall term and are also retained (RetainedInd=1) in the next Fall term.
The tables involved in the model, sample data and the relationships are shown below. It has 2 inactive relationship because it wouldn't allow direct active relationship because active indirect relationships already existed.

 

Based on the sample data, I should get only 1 student (StudentID=1) who has pledged in the Spring and Retained in the Fall but I'm getting back 2 with the following measure:
Pledged and Retained =

CALCULATE(SUM(SpringPledge[PledgedInd])
,FILTER(FallRetention,FallRetention[RetainedInd]=1)
,FILTER(SpringPledge,Spring_Pledge[PledgedInd]=1)
,USERELATIONSHIP('DWH Academic_Term_Dim'[Term_Key_First_Fall],'First Fall Retention'[Term_Key])
,USERELATIONSHIP('DWH Academic_Term_Dim'[Term_Key_Next_Excluding_Summer], Spring_Pledge[Term_Key])
)

 

How do I get the right results?

 

Student
StudentID, TermCode
1, 202009
2, 202009
3, 202009

 

Term
TermCode, Term, TermCodeNextSpring, TermCodeNextFall
202009, Fall, 202101, 202109
202101, Spring, 202201, 202109

 

SpringPledge
StudentID, TermCode, PledgedInd
1, 202101, 1
2, 202101, 1
3, 202101, 0

 

FallRetention
StudentID, TermCode, RetainedInd
1, 202109, 1
2, 202109, 0
3, 202109, 1

 

Active Relationships
Term.TermCode to Student.TermCode
Student.StudentID to SpringPledge.StudentID
Student.StudentID to FallRetention.StudentID

 

Inactive Relationships
Term.TermCodeNextSpring to SpringPledge.TermCode
Term.TermCodeNextFall to FallRetention.TermCode

2 REPLIES 2
dospencer
Frequent Visitor

Thank you. Your suggestions worked in resolving my use case.

amitchandak
Super User
Super User

@dospencer , Term, and student are dimensions with two facts Spring and Fall and the two facts should not join with each other, You should create two measures one from each fact, and make a decision based on that

 

If need you can add column sping and fall in tables and append them Append : https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

 

I think you need measures like (refer to use of isblank and how use values )

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...

 

 

If this does not help
Can you share a sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.