Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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 
  • 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.

5 Replies

    • Anonymous's avatar
      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.

       

       

      • amitchandak's avatar
        amitchandak
        Super User

        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

  • v-xicai's avatar
    v-xicai
    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.