Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
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.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!