Forum Discussion

Ricardo_Schmidt's avatar
Ricardo_Schmidt
Regular Visitor
6 years ago
Solved

Making a reationship without making a huge table

Hello everyone,

 

I'm starting using Power BI now and maybe my doubt is not that hard, but I need some help. Anyway I'm learning.

 

I have a table like this one that I will use to make my graphs.

 

DateNumberActivityHoras
28/01/2004223638A4,5
07/11/2003243451A2,5
30/04/2008275816A9
05/03/2001587967B8,37
20/05/2005589254B9
06/08/2017590244C9
06/06/2001551066C5
05/03/2001590684C5
22/09/2008590687A9
14/11/2017223280A1,5
16/08/2004591977B9
05/02/2009594034B3
05/04/2009590043B3,5
09/12/2001593646C7,87

 

And I have another table that brings me the efficiency of te activities during a period (it changes with time).

 

ActivityBeginning DateFinish DateEfficiency
A01/03/199730/06/20000,88
A01/07/200031/03/20040,91
A01/04/200430/09/20060,8822
A01/10/200601/01/20200,91
B01/10/200601/01/20200,91
B01/01/198028/02/19970,86
B01/03/199730/06/20000,88
B01/07/200031/03/20040,88
B01/04/200430/09/20060,85
C01/01/198028/02/19970,88
C01/03/199730/06/20000,9
C01/07/200031/03/20040,91
C01/04/200430/09/20060,8672
C01/10/200601/01/20200,895
D01/08/201101/01/20200,88

 

I just need to put the efficiency in the first table using the activity and the dates condition. I could make a huge table with all the dates and activities or a very large IF condition. Is there an easier way to make this relation?

 

Thank you guys

  • Here is the data based on the date range concept. See this file.

     

    What I did is this:

    1. In your 2nd table, I called Activity, I added a list of dates between Start and Finish dates, then expanded that.
    2. In the 1st table, called Table, I merged the Activity and Date to the Date Range
    3. Then I expanded the efficiency field.
    4. I made sure Activity was not set to load
    5. Made sure Table was set to load.

    This is what is now in the data model.

     

    If that isn't what you want, be very very clear in your follow up. THanks!

     

    How to get good help fast. Help us help you.
    How to Get Your Question Answered Quickly
    How to provide sample data in the Power BI Forum

3 Replies

  • edhans's avatar
    edhans
    Community Champion

    How do you want to merge the tables, Based on the start date, end date, or in between the dates? And if in between, what about duplicates? Or are you sure there can be none?

    • edhans's avatar
      edhans
      Community Champion

      Here is the data based on the date range concept. See this file.

       

      What I did is this:

      1. In your 2nd table, I called Activity, I added a list of dates between Start and Finish dates, then expanded that.
      2. In the 1st table, called Table, I merged the Activity and Date to the Date Range
      3. Then I expanded the efficiency field.
      4. I made sure Activity was not set to load
      5. Made sure Table was set to load.

      This is what is now in the data model.

       

      If that isn't what you want, be very very clear in your follow up. THanks!

       

      How to get good help fast. Help us help you.
      How to Get Your Question Answered Quickly
      How to provide sample data in the Power BI Forum

      • Ricardo_Schmidt's avatar
        Ricardo_Schmidt
        Regular Visitor

        That's exactly what I need. Between the dates, with the reference being the activity and the date from table 1.

        I was unable to use Power BI because computer problems, but I'll try this solution now.

        Thanks a lot.