Forum Discussion

ahmadov_10's avatar
ahmadov_10
Helper II
5 years ago
Solved

using a current value for a column from Previous STEP - Power Query

Hello Experts,
My business need with Power Query :
I'm tried to save the same values in the columns (id_bu_rh) and (id_bu_ctr) ( a completed list of id) : for these reason i created the step Duplicated Column .
after i have a modification step called #"distinct annee, mois" : this is essential for work (but this step affects (id_bu_rh) , (id_bu_ctr) which become only with values : (0,1))

So I want to make a step that combine the columns
of #"distinct annee, mois" with the columns (id_bu_rh) , (id_bu_ctr) in the previous step Duplicated Column (or navigation)

this is my code this my power Query code and i think I am close to the result : just to fix how to call an element value (column) from a previous step :

 

let
Source = PostgreSQL.Database("localhost", "datamart"),
polaris_datamart_fait_ca = Source{[Schema="polaris_datamart",Item="all_combinationations_v"]}[Data],
#"Duplicated Column" = Table.DuplicateColumn(polaris_datamart_fait_ca, "id_bu_rh", "id_bu_rh - Copy"),
#"distinct annee, mois" = Table.Distinct(#"Duplicated Column", {"annee", "mois"}),
#"step_final" = Table.AddColumn(#"distinct annee, mois","col_bu_RH", each (#"Duplicated Column"[id_bu_rh]))
in
#"step_final"

 

( amitchandak   , selimovd   parry2k  , Greg_Deckler  Pragati11  MarcelBeug v-qiuyu-msft 

 and all community of super stars , i need your helps ). BEST REGARDS

 

This is my screenshots below

  • ahmadov_10 not sure I followed this step, you are creating a list with two values "anee and mois"

     

    what you are trying to achieve here, I'm not fully sure from your post.

     

    #"distinct annee, mois" = Table.Distinct(#"Duplicated Column", {"annee", "mois"}),

     

3 Replies

  • ahmadov_10 not sure I followed this step, you are creating a list with two values "anee and mois"

     

    what you are trying to achieve here, I'm not fully sure from your post.

     

    #"distinct annee, mois" = Table.Distinct(#"Duplicated Column", {"annee", "mois"}),

     

    • ahmadov_10's avatar
      ahmadov_10
      Helper II

      Hi parry2k ,

      your remark is very relevant : the step distinct (annee,month) is created with an old version in the project and i tried to understand it : i find in database editor with SQL query , that this is step is similar to over partition to save one row only for each (year , month) and the first row was always with id =0 or 1. so when we call the previous step that contains all the id to make an append operation (pervious id) to the actual step (actual id) ---> it will be the same , no changes (0,1) , and no errors.

      because  : previous step : the completed table = 5000 rows

      actual step (distinct (annee,mois) = 49 rows

       

      Many thanks for you and Pragati11  : I accept your answer as solution      

       

       

       

  • Hi ahmadov_10 ,

     

    I am not very much clear on the requirement. Can you add more details please?

     

    Thanks,

    Pragati