Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

How to prevent refresh of data when using outer join ?

Hi all,

 

I need to know in a table if this is the first time the application is deployed.

Algorithm is as follow : 

- get all applications (from csv file),

- for each application, get the application deployment informations (application details, deployment environnement, deployment date, version deployed, one HTTP call per application, 200+ applications....)

- determine if this is the first time the application is deployed with this version on the environment.

 

In order to determine if this is the first time, the solution I found is to sort all lines by application name, environment, version, and deployment date, and the compare current line with previous line to check if this is the same version, environment and application. If yes, insert in a new column the previous version, if no, insert "first".

 

The solution I found to compare from previous line is to user outer join, as described in this site (in French, sorry ;)) : Trucs et astuces - PowerQuery - Archétypes synergies (excel-formations.fr)

- sort lines as described previously,

- add to indexes,

- insert in a new column an outer join (= Table.NestedJoin(#"Index ajouté", {"Index"}, #"Index ajouté", {"Index.1"}, "Index ajouté", JoinKind.LeftOuter))

- then compare the values to determine if this the first time the version is deployed.

 

Problem is : result is very slow. I can see that for every line, when the compare is done from the outer join, a new HTTP call is done. I tried to use a buffer in different steps, but result is the same : the query is incredibly slow.

 

Questions are : 

- would you have a better solution to compare the lines, and determine if the version is deployed for the first time?

- or would you have a solution to prevent a new HTTP call every time?

 

Thanks for your help 😉

 

2 Replies

  • There is no need for nested joins. Do a Table.Buffer and then a Table.SelectRows.

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Please show the expected outcome based on the sample data you provided.

    https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Anonymous's avatar
    Anonymous
    Not applicable

    Sorry about that.

     

    Here is a sample data : I would like to add the column previous_version, based on the formula described before.

     

    Before : 

    application_codedeployment_dateversionenvironment
    AFK12/01/2023 12:051.0.0staging
    AFK14/01/2023 14:271.0.1staging
    AFK14/01/2023 17:041.0.2staging
    AFK15/01/2023 09:371.0.2staging
    AFK16/01/2023 23:051.1.0staging
    AFK23/01/2023 04:341.1.0staging
    AFK24/01/2023 10:431.1.1staging
    AFK17/01/2023 03:561.0.2prod
    AFK18/01/2023 12:541.0.2prod
    AFK19/01/2023 17:431.1.1prod

     

    After:

    application_codedeployment_dateversionenvironmentprevious_version
    AFK12/01/2023 12:051.0.0stagingfirst
    AFK14/01/2023 14:271.0.1stagingfirst
    AFK14/01/2023 17:041.0.2stagingfirst
    AFK15/01/2023 09:371.0.2staging1.0.2
    AFK16/01/2023 23:051.1.0stagingfirst
    AFK23/01/2023 04:341.1.0staging1.1.0
    AFK24/01/2023 10:431.1.1stagingfirst
    AFK17/01/2023 03:561.0.2prodfirst
    AFK18/01/2023 12:541.0.2prod1.0.2
    AFK19/01/2023 17:431.1.1prodfirst

     

    I will try again with a Table.SelectRows, thanks.