Forum Discussion

purple_SP's avatar
purple_SP
Helper I
2 years ago
Solved

Help with incrementally refreshing an entity computed from two separate dataflows

Hi everyone, 

 

I am have a dataflow that I am trying to optimize in my workspace and was hoping to get some advice regarding the incremental refresh. Essentially the dataflow is generated from merging two other dataflows.

 

The first dataflow stages some data from sharepoint in an entity like so:

 

dateidused
22/02/2024  AEFY
23/02/2024  BCPN

 

 

And the second dataflow stages some data from the data warehouse into an entity like this:

 

datecodegroupmetric
22/02/2024  ACPA1
22/02/2024  AOPA5
22/02/2024  AEFB3
22/02/2024  AEFC4
22/02/2024BCPB2

 

Essentially I want to filter rows in the second dataflow to only contain codes that match to ids in the first entity.

The dates in the first entity are irrelevant.

 

At the moment, I have been grouping the first entity by "id" and "used", then merging it (left joining) with the second entity and filtering rows where code is null:

 

grouped entity:

 

codeused
AEF    Y
BCP   N

 

After merge and filtering:

datecodegroupmetric
22/02/2024   AEFB3
22/02/2024   AEFC4
22/02/2024   BCPB2

 

This is working, but it is very slow. I suspect this is due to the size of the second entity.

 

The data should be refreshed daily. However, while the table coming from the datawarehouse is being incrementally refreshed, I suspect that the full table for the final entity is doing a full refresh everyday.

 

Is there a way to ensure that only the most recent data is being refreshed in the final entity? 

Would it make more sense to left join the second entity to the first instead?

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  purple_SP ,

     

    Instead of merging the entire second entity with the grouped first entity, consider filter the second entity firs, you may apply a filter to the second entity to only include rows with codes that exist in the first entity. This can be done using a list of unique IDs from the first entity. If possible, use an inner join instead of a left join, as it can be more efficient when you only need matching rows.


    You can use parameters to dynamically filter the data being loaded. Create a parameter for the date range you want to refresh. then apply this parameter to filter the second entity before merging.

    Finally you may consider using staging tables to store intermediate results. This can help break down the process into smaller.

    You can stage the filtered second entity, create a staging table that only contains the filtered rows from the second entity and then merge with the first entity, which perform the merge operation on the staged data.

     

    Best regards.
    Community Support Team_Caitlyn

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  purple_SP ,

     

    Instead of merging the entire second entity with the grouped first entity, consider filter the second entity firs, you may apply a filter to the second entity to only include rows with codes that exist in the first entity. This can be done using a list of unique IDs from the first entity. If possible, use an inner join instead of a left join, as it can be more efficient when you only need matching rows.


    You can use parameters to dynamically filter the data being loaded. Create a parameter for the date range you want to refresh. then apply this parameter to filter the second entity before merging.

    Finally you may consider using staging tables to store intermediate results. This can help break down the process into smaller.

    You can stage the filtered second entity, create a staging table that only contains the filtered rows from the second entity and then merge with the first entity, which perform the merge operation on the staged data.

     

    Best regards.
    Community Support Team_Caitlyn