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
jalaomar
Helper IV
Helper IV

Combine datasources

Hi all,

 

Is it possible to combine different datasources that have information sitting in different datasources for the same project.

please see attached screenshot of the outcome I am looking for.

 

Project A has Date1 in Table1

Project A has Date2 in Table2

 

How can combine these information in one single table?

 

BR

J2021-11-06_09-07-59.png

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @jalaomar ,

You can create a calculated column as below to get the Date2 and check whether that is what you want...

NDate2 = 
VAR _date2 =
    CALCULATE (
        MAX ( 'Table2'[Date2] ),
        FILTER (
            'Table2',
            'Table2'[Project] = 'Table1'[Project]
                && 'Table2'[Date2] >= 'Table1'[Date1]
        )
    )
RETURN
    IF ( ISBLANK ( 'Table1'[Date2] ), _date2, 'Table1'[Date2] )

yingyinr_0-1636448632614.png

If the above one is not working for your scenario, please provide more sample data with Text format and your expected result included with backend logic and special examples. Thank you.

Best Regards

Community Support Team _ Rena
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

8 REPLIES 8
v-yiruan-msft
Community Support
Community Support

Hi @jalaomar ,

You can create a calculated column as below to get the Date2 and check whether that is what you want...

NDate2 = 
VAR _date2 =
    CALCULATE (
        MAX ( 'Table2'[Date2] ),
        FILTER (
            'Table2',
            'Table2'[Project] = 'Table1'[Project]
                && 'Table2'[Date2] >= 'Table1'[Date1]
        )
    )
RETURN
    IF ( ISBLANK ( 'Table1'[Date2] ), _date2, 'Table1'[Date2] )

yingyinr_0-1636448632614.png

If the above one is not working for your scenario, please provide more sample data with Text format and your expected result included with backend logic and special examples. Thank you.

Best Regards

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

Hi @v-yiruan-msft, I could not make it work with my appended query.

Below you can see that I have 3 tabels with source data and i want all information for all projects to be in the same table, hence I need to append them (due to KPI calculation)

Could you maybe support?

 

GPR Data

Project IDBaselineActual
A2021-12-23 
B2021-11-02 
C2021-10-142021-10-14
D2021-04-232021-04-20

 

Project File Data

Project IDBaselineActual
E2021-11-122021-11-13
F2021-12-23 

 

PV Data

Project IDBaselineActual
A 2021-12-25
B 2021-12-27
F 2021-12-30

 

Expected Outcome (Append the 3 above tavles as new query in Power BI)

 

Project Performance 

Project IDBaselineActual
A2021-12-232021-12-25
B2021-11-022021-12-27
C2021-10-142021-10-14
D2021-04-232021-04-20
E2021-11-122021-11-13
F2021-12-232021-12-30

Hi @v-yiruan-msft , Thank you! Will try it out today. Just a question, will this calculated column work if I append the two tables?

because i need to append to be able to have all the ID's in one table. 

 

BR

J

speedramps
Super User
Super User

Hi Jalortmar

 

Grouping instructions as requested .
Simply replace the SUM operation with MAX

 

https://docs.microsoft.com/en-us/power-query/group-by

Hi, I tried to do the steps but it's not working. What am I doing wrong?2021-11-07_10-17-19.png

AlexisOlson
Super User
Super User

How do you know that the green date belongs in that row?

 

If you had another row in the blue table,

A  2021-05-31 (blank)

would the green date pair with this row, the top row, or both?

speedramps
Super User
Super User

In Power Query append the tables.
Then in Power Query group the new table by project and Date1 with max Date2.

Hi @speedramps , Thanks! I know Append query but never done this grouping. would you like to show from a screenshot how that is done?

 

BR

J

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.