Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hey,
I have both Customer and Sales tables that I need to have relationships with the Date table.
The Customer table needs two relationships with the Date table for Gain Date and Loss date. The Sales table needs a relation with the date table as well.
So far this is the closest model I have. But it isn't working correctly yet.
Here is my report containing a sales table as well as information about the Gains and Losses of Customers.
Strangely enough the total Losses is correct but the Total Gains are way off. It should be 29. I have tried all the different combinaions of active and inactive relationships as well as DAX but can not get the final piece.
Here is a link to the report. I would appreciate some help with this.
Thanks
Solved! Go to Solution.
I found the answer which uses the function TREATAS. First I removed the inactive relationships. I then used the following DAX, which worked.
Gains = CALCULATE([Count of Customers],
TREATAS(VALUES('Date'[Date]),Customer[Gain Date]))
Loss = CALCULATE([Count of Customers],
TREATAS(VALUES('Date'[Date]),Customer[Loss Date])) *-1
Net Gain/Loss = [Gains]+[Loss]
@BudMan512 , Explain the relationships between tables and how those relationships are working.
I found the answer which uses the function TREATAS. First I removed the inactive relationships. I then used the following DAX, which worked.
Gains = CALCULATE([Count of Customers],
TREATAS(VALUES('Date'[Date]),Customer[Gain Date]))
Loss = CALCULATE([Count of Customers],
TREATAS(VALUES('Date'[Date]),Customer[Loss Date])) *-1
Net Gain/Loss = [Gains]+[Loss]
I am attempting to use one Date table for connecting to the Sales table and Customer table. The Date table has an active relationship with Sales. The Customer table is connected with two inactive relationships so I can count the Gain Dates and Loss Dates. This arrangement is not working so I am looking for a way to make it work. I am open to suggestions.
Here is the DAX for the two inactive relationships that I am having a problem with.