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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Victor_AguirreV
Regular Visitor

Issues with Relationships and Calculate function

Hello guys!

 

I have the following DataModel:

 

Victor_AguirreV_0-1710964711535.png

 

And what I am trying to do is get the total number of chargebacks, calculated by counting the primary key in All_CBs table called "Journal ID". Then I need that count, divided by the total deposits in All_dep_bd, which is also a count on the primary key there called "Journal ID" as well.

 

The relationships are:

 

  • All_dep_bd (which has the deposits) is related to the Calendar table by the Date field in a many to one. This relationship is inactive
  • All_CBs is related to the Calendar table by the Date field in a many to one. This relationship is inactive
  • All_CBs and All_dep_bd are related to a Dim table called Player List, by "Player" field. 
  • Player List is related to the Calendar table by the Date field in a many to one relationship. This relationship is active.

 

This results in the following:

 

Victor_AguirreV_1-1710965682408.png

 

The table to the left has the date from the calendar table. The table to the right, has the date field from the All_CBs table.

 

The measure is the following:

 

Total CBs = CALCULATE(
        COUNTROWS(All_CBs),
        FILTER(All_CBs,All_CBs[IsSuperAFF]="Yes")
    )
 
the IsSuperAff field, checks whether the customer falls into the marketing group we are trying to use the calculation on.
 
Why is it that when I use the date from the Calendar table, I get different results, but when I use the date from the actual CB table, I get different numbers?
 
 
 

 

1 ACCEPTED SOLUTION
Victor_AguirreV
Regular Visitor

Hello Guys,

 

I solved it. My apologies if someone was trying to figure this out. This was the solution:

 

Total CBs by CB Date = CALCULATE([Total CBs],
    USERELATIONSHIP('Calendar'[Date], All_CBs[Date Chargeback])
)
 
Total CC Deposits by Date = CALCULATE([Total CC Deposits],USERELATIONSHIP(All_dep_bd[Short.Date],'Calendar'[Date]))
 
CB Rate = DIVIDE([Total CBs by CB Date], [Total CC Deposits by Date])

 

View solution in original post

1 REPLY 1
Victor_AguirreV
Regular Visitor

Hello Guys,

 

I solved it. My apologies if someone was trying to figure this out. This was the solution:

 

Total CBs by CB Date = CALCULATE([Total CBs],
    USERELATIONSHIP('Calendar'[Date], All_CBs[Date Chargeback])
)
 
Total CC Deposits by Date = CALCULATE([Total CC Deposits],USERELATIONSHIP(All_dep_bd[Short.Date],'Calendar'[Date]))
 
CB Rate = DIVIDE([Total CBs by CB Date], [Total CC Deposits by Date])

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors