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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Ricardo_Schmidt
Regular Visitor

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

1 ACCEPTED SOLUTION

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
    1. 2020-03-26 17_50_50-.png
  3. Then I expanded the efficiency field.
  4. I made sure Activity was not set to load
    1. 2020-03-26 17_52_08-.png
  5. Made sure Table was set to load.

This is what is now in the data model.

2020-03-26 17_53_01-20200326 - Power Query Merge based on Date Range - Power BI Desktop.png

 

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



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Super User
Super User

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?



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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
    1. 2020-03-26 17_50_50-.png
  3. Then I expanded the efficiency field.
  4. I made sure Activity was not set to load
    1. 2020-03-26 17_52_08-.png
  5. Made sure Table was set to load.

This is what is now in the data model.

2020-03-26 17_53_01-20200326 - Power Query Merge based on Date Range - Power BI Desktop.png

 

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



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors