Forum Discussion

se2's avatar
se2
Icon for Helper II rankHelper II
5 years ago

Messy files --> data to table

I have some excel files that come in different flavor, some of them will be unpredicatable, they all contain the same information but the formats can vary, making it hard to extract the infromation and put it into a master table.  But there are some prevalent types none of which is that hard to process in power bi.  I will show 2 types here and the expected results.  I would know how to recognize the types of forms I will be showing with code but I would like to learn how to do these things with power bi, the modern way.

1.a Can power query get all of the files, from a given folder (https://powerbi.tips/2016/06/loading-data-from-folder/)

1.b. so that it is ready to look at each one and decide what to do.  (not sure) 

2.a.  Can power query BI then have some canned schemas in mind (https://www.thebiccountant.com/2020/07/15/transform-a-query-into-a-function-in-power-query-and-power-bi/)

2b. and can it decide which ones to used based on what it sees, in a given file? (not sure) 

  1. Also I do not know how to copy information from a set of cells into another row? (https://community.powerbi.com/t5/Power-Query/Copying-value-to-another-row-based-on-another-column/m-p/1209390) and other hits from google on messy files.

For instance,  here is one common type of file?

https://www.dropbox.com/scl/fi/5mdj6tbt29lfqs5j8xhiv/BE-WISE.xlsx?dl=0&rlkey=tqwmowucc6q8btz3a73rvwdf7 

For the above, can power bi recognize that

  1. this as a table that has no code info in 3 rows
  2. if it can realize that this is a certain type of file, then it go ahead and copy the code infor from the "this is a note" row, into the following 3 rows,
  3. then delete the "this is a note row" 

The expected result should look like this:

https://www.dropbox.com/scl/fi/eltecp9udz274pdrpenf7/BE-WISE-intended-result.xlsx?dl=0&rlkey=y6ufcjf8s7aa48l4kf0fc6qdx 

Here is another type:

 https://www.dropbox.com/scl/fi/h055pmuc1i3om3uqvjd8m/BILL-MOON.xlsx?dl=0&rlkey=7732iqgzxa39ootcwkkmrko04

 

The expected result should look like this:

Note that

  1. "5 x $110.00" was concatenated to the row above
  2. and the amount was also moved to the row above.

 https://www.dropbox.com/scl/fi/o2y8oxhq8jexgiindgbu5/BILL-MOON-intended-result.xlsx?dl=0&rlkey=hlg5kpr6bn1tbpf9tr3x8e3d1 

Lastly, I would like to extract information from each cleaned up form and put it into a table: 

Expected result: 

https://www.dropbox.com/scl/fi/8pnuo06f7iyhxuukfzvak/table-intended-result.xlsx?dl=0&rlkey=u7nvwwqkt3syy3ld6qko3atcw

Any help with this will be appreciated,

Thanks,

SE

 

 

 

 

 

 

 

 

 

2 Replies

  • Please let me know if you are unable to view the dropbox files, I had trouble pasting in the tables.