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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
andrew_hardwick
Helper III
Helper III

you can't create a direct active relationship between Survey and Incident

I am trying to create a report showing the number of survey responses received based on the number sent. The number sent is stored in the Incident Table and the received in the Survey table. Each table also has a date, which I am using a date table to compare.

 

The table is working, and shows 4 columns; Date, Surveys Sent, Surveys Received and percentage. I would also like to be able to filter on the country where the survey was sent from (stored as a field in the Incident Table). As I want the sent surveys to be linked to the received surveys, I tried to create a relationship, but as there is already one between dates, I got an error.

 

Any suggestions how to get around this?

 

 Capture.PNG

1 ACCEPTED SOLUTION
vanessafvg
Super User
Super User

there are 2 ways of dealing with role playing relationships (that is what it is when a date from the same date table is being used 2 x but linked to different dates)

 

1. use  the userelationship function for an inactive relationship (dotted line is an inactive relationship), i.e

=CALCULATE(SUM(InternetSales[SalesAmount]), USERELATIONSHIP(InternetSales[ShippingDate], DateTime[Date]))

https://msdn.microsoft.com/en-us/library/hh230952.aspx

 

2. Create another date table and use that table to link the 2nd date so that the relationship is active 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

USERELATIONSHIP


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

i love how verbose you are @Greg_Deckler Woman LOL





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




vanessafvg
Super User
Super User

there are 2 ways of dealing with role playing relationships (that is what it is when a date from the same date table is being used 2 x but linked to different dates)

 

1. use  the userelationship function for an inactive relationship (dotted line is an inactive relationship), i.e

=CALCULATE(SUM(InternetSales[SalesAmount]), USERELATIONSHIP(InternetSales[ShippingDate], DateTime[Date]))

https://msdn.microsoft.com/en-us/library/hh230952.aspx

 

2. Create another date table and use that table to link the 2nd date so that the relationship is active 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Thats great, I added a userelationship formula and it worked fine. Thanks.

Hi @andrew_hardwick , could you please share the measure you created with userelationship? In which table did you created the measure? What did you do after creating the measure?

 

I have an identic problem, hope you can help me! Thanks 

Hi @Min_02 ,

 

Sure, I created this measure in the Incident Table.

 

Survey Responses = CALCULATE(counta(Survey[Name]),USERELATIONSHIP(Survey[Created Date],'Date'[Date]))
 
I cannot remember exactly what I did next (it was 3 years ago 😀), but presumaby I just used it in my visualisations.
 
Regards,
 
Andy

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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