Forum Discussion

Thomas_MedOne's avatar
Thomas_MedOne
Helper III
1 year ago
Solved

Copying column value until value changes then new value

I have this system that outputs log files but it does so in an infuriating way. The data pretty much looks like this (with more columns)

 

Call IDFromToResultDate/Time
11111222614-111-1212614-555-1212Queue 112/31/2024 10:03:00
 614-111-1212614-555-1212IVR OPT 112/31/2024 10:03:00
 614-111-1212614-555-1212voicemail12/31/2024 10:03:00
11111223614-222-1212614-555-1212Queue 112/31/2024 10:05:35
 614-222-1212614-555-1212IVR OPT 112/31/2024 10:05:35
 614-222-1212614-555-1212voicemail12/31/2024 10:05:35

 

So, essentially the CSV is sort of pivoted, I guess. I don't know what you call it and, of course, this is only sample information. What I need is some sort of power Query script or something else which will duplicate the 11111222 to the other two blank lines and then when it hits 11111223 it then copies that 1111223 to the next two blank lines, etc.

There may be 3 blanks, 5 blanks depending on the routing, or any other number of blanks.  This way I can report on the routing of these calls.

 

What is possible? Do I automate it in excel before sending the CSV to Power BI or do something in Power BI in Power Query?

  • Anonymous's avatar
    Anonymous
    1 year ago

    Why that just sounds like you need to use Table.FillDown on the GUI. if they are not actually null values,  replace that value with nulls and then fill down.

     

    --Nate

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Why that just sounds like you need to use Table.FillDown on the GUI. if they are not actually null values,  replace that value with nulls and then fill down.

     

    --Nate

    • Thomas_MedOne's avatar
      Thomas_MedOne
      Helper III

      Thanks, I had tried fill down but I didn't know about the nulls. They were "blanks" so I converted them to nulls and i'm in business. Thanks.

    • Thomas_MedOne's avatar
      Thomas_MedOne
      Helper III

      This was the solution but Watkinnc was just a bit closer because I tried this and it didn't work. I had to convert them to nulls first.

  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Hi Thomas_MedOne,

     

    We sincerely appreciate your inquiry through the Microsoft Fabric Community Forum.

     

    Please find below the process to use Power Query for filling down the Call ID values:

    1. Load the Text/CSV file data into Power BI.
    2. After loading the data, click on Transform Data to open the Power Query Editor.
    3. Inspect the Call ID column, where blank rows need to be filled. Replace the blank values with Null if blank cells are not already recognised as nulls.
    4. Select the Call ID column, navigate to the Transform tab, click on Fill, and choose Down. This will fill all blank cells in the column with the last non-blank value above them.
    5. Preview the data to ensure that all blank rows under the Call ID column have been correctly filled with the appropriate values.
    6. Click on Close & Apply in the Home tab of the Power Query Editor to load the data back into Power BI with the filled Call ID values.

    Please find the attached screenshot and PBIX file for your reference:

    If you find this response helpful, kindly mark it as the accepted solution and provide kudos. This will assist other community members facing similar queries.

     

    Thank you.