Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
mattbrice
Solution Sage
Solution Sage

Power Query problem

I need to do a transformation on a table that I not sure how to accomplish.  

 

Monthly we download a csv file from our credit card vendor that is then turned around and uploaded into our accounting system.  The csv consists of one header row with invoice header information and all the remaining rows are detail line item rows for the resepctive invoice.  

 

What I have been tasked with is to transform the file so that each line item Detail row is its own invoice.  So instead of having one header row and numerous detail lines, I want one header row for each line item detail.

 

First column in each row identifies it as either a 'H'eader row, or 'D'etail row.  Header row has invoice number (Column C) which needs to have number updated with a -1, -2... -N (depending on number of detail lines).  Header also has sum of details (Column N) which needs to be updated to be same number as respective detail line.

 

Only thing that needs to change on detail line is update Invoice number (Column C) to match Header invoice number.

 

Before:

before.jpg

 

 

After:

after.jpg

 

 

Here is link with the sample data as shown. 

 

Sample_Data

 

Thanks for any help.

1 ACCEPTED SOLUTION
v-xjiin-msft
Solution Sage
Solution Sage

Hi @mattbrice,

 

Based on your requirement, I have made a sample report. Please make a reference here, hope it helps.Smiley Happy

 

Thanks,
Xi Jin.

View solution in original post

2 REPLIES 2
v-xjiin-msft
Solution Sage
Solution Sage

Hi @mattbrice,

 

Based on your requirement, I have made a sample report. Please make a reference here, hope it helps.Smiley Happy

 

Thanks,
Xi Jin.

@v-xjiin-msft thank you very much.  It worked perfectly.

 

Matt

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors