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
Anonymous
Not applicable

Double Relationship Between Two Tables

Hi Power BI Community!

 

I finally managed to create the waterfall visual I wanted using the solution tagged in below, which I am incredibly excited about. Unfortunately, I have now come across another issue when filtering for the data within my visual. When I click on my data, I only return data with open dates related to the visual, not showing the closed dates, which is very unfortunate.

 

Now my question is, is there a way I can connect both the open date and closed date to my date table? As a reference, my table looks like below and has a connection between my open date to my date table. I saw other solutions mentioning concatenating two columns, but I don't see that working for my two dates.

 

https://community.powerbi.com/t5/Desktop/Dax-Waterfall-Calculation-Help/m-p/1382921#M589473

 

Ticket NumberOpen DateClose Date
11/3/20184/8/2018
21/23/20184/2/2018
36/3/20188/9/2018
46/30/20189/4/2018
59/18/201810/3/2018
610/10/20189/9/2019
712/30/20181/2/2019
83/22/20197/1/2020
94/9/20198/9/2020
104/28/20199/8/2020
117/8/20191/2/2020
128/9/20193/9/2020
139/10/201910/9/2020
1411/4/20194/9/2020
152/2/20209/3/2020
163/4/20208/4/2020
175/8/2020 
187/20/2020 
199/7/2020 
209/20/2020 
1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create an active relationship on 'Date table'[Date] and 'Fact table'[Date1] ,  and then create an another inactive relationship on 'Date table'[Date] and 'Fact table'[Date2] . Once you need the relationship about 'fact table'[Date2], just to create column or measure using USERELATIONSHIP like DAX below.   ( Note that the [Date1] could be the frequently used one. In your scenario, the [Date1] may be [Open Date], and the [Date2] may be [Close Date] ),

 

Total Sales= CALCULATE (SUM('fact table'[Sales]) ),USERELATIONSHIP ( Date[Date], 'fact table'[Date2] ))

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create an active relationship on 'Date table'[Date] and 'Fact table'[Date1] ,  and then create an another inactive relationship on 'Date table'[Date] and 'Fact table'[Date2] . Once you need the relationship about 'fact table'[Date2], just to create column or measure using USERELATIONSHIP like DAX below.   ( Note that the [Date1] could be the frequently used one. In your scenario, the [Date1] may be [Open Date], and the [Date2] may be [Close Date] ),

 

Total Sales= CALCULATE (SUM('fact table'[Sales]) ),USERELATIONSHIP ( Date[Date], 'fact table'[Date2] ))

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Join both of them with date table. One will active another one will be inactive. you can use userelation to use the other join.

https://youtu.be/e6Y-l_JtCq4

Or https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

But in case you need to filter both open and close on different time ranges then use two date tables or use slicer from these dates only.

Anonymous
Not applicable

Hi @amitchandak! Thank you again for your help and referencing your HR analytics article!

 

Would you mind clarifying what you mean by joining both of them with the date table? I turned on the Open Date relationship with the Date table, but I cannot turn on the Closed Date relationship with the Date table since I can only have one relationship between two tables I believe. I used the two HR Employee and Terminated Employee formulas for my one calculation, but I currently cannot connect both dates to the Date table.

 

 

@Anonymous , You should able to join both open and close date with date tables. Only one join will be active. For others, you have use userelation.

In case open and close date need to run on different months(say) you need use that date slicer or two date tables.

 

what is expected output

Anonymous
Not applicable

Hi @amitchandak, just to clarify, I am using both the open and close dates in my calculation but only able to reference the open date. I currently have two visuals: waterfall (showing different between tickets opened and closed by month) and table (showing a list of tickets regardless of opened and closed dates). I would like to click on a bar in my waterfall and show me both the tickets that were opened and closed that month. It's not currently possible with my connections because I only have the open date relationship on and cannot activate the close date relationship. Any idea to showcase both dates in my visuals?

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.