Forum Discussion
Norman_McIlwaine
Aug 18, 2023Brass Contributor
Need help to resolve Excel Formula using Let,Take,index,Sort,Unique,HSTACK,MMULT,TOROW,MONTH.
I am trying to add 5 additional columns to the function but can get only a $value: Function : =LET(r,B1:G8,m,6,a,TAKE(r,,1),b,INDEX(r,,2),c,INDEX(r,,3),d,INDEX(r,,4),e,INDEX(r,,5),f,INDEX(r,,...
- Sep 07, 2023
Thank you. Do I understand correctly that csv62719 is you source file. If to avoid Power Query we copy/paste data from it into the sheet in main file, here by formula create massaged range and based on it and month/year/monthid parameters create aggregated result. Workflow is correct?
Norman_McIlwaine
Sep 08, 2023Brass Contributor
Thank you so much for your support and help. I have made the necessary updates to the formula to accept the new massaged download. it took a while and I now have what is an acceptable output to assist me in performing my own finances. I am including the file for your perusal if you think I could make any other changes please let me know. In the meantime, I am going to try Power Query to assist me in massaging the download prior to using it with your formula.
Once again thank you for your help, you surly are the best on this subject.
SergeiBaklan
Sep 08, 2023MVP
Preliminary I added formula into Report sheet.
- Norman_McIlwaineNov 27, 2023Brass Contributor
I have a small problem with not having the capabilities to refresh the data on a IPAD, it is imposable to change the month and get accurate results in the Excel output. I have tried to work around this and still run into the same problem, I have also requested this as an enhancement to Excel. However, it is not high on their priority list, and I can't get enough votes to get the fix to move it up on the list.
Is there any other way to get the results without having to do a refresh every time.?
- Norman_McIlwaineOct 08, 2023Brass ContributorThank you for the quick and excellent response.
- SergeiBaklanOct 08, 2023MVP
With Power Query it's better to calculate it separately (Opening Balance query in attached file), result will be like
and Closing Balance is calculated as
=SUBTOTAL(109,[Amount]) + Opening_Balance[Opening Balance]
- Norman_McIlwaineOct 07, 2023Brass Contributor
I am trying to set current month's ending balance to be next month's opening balance. I have tried various different date functions (i.e.PreviousMonth) but cannot get this to work. Is this possible in PQ?
(previous months balance)
Opening Balance 2,349.73 (Current month)
Balance 3,594.20
- SergeiBaklanSep 27, 2023MVP
Norman_McIlwaine , okay, thank you for the feedback.
- Norman_McIlwaineSep 27, 2023Brass ContributorThanks problem solved.
- SergeiBaklanSep 27, 2023MVP
Replacement table is in the first sheet of the file, in grid.
Modify it here and Refresh All. Power Query only reads that table.
- Norman_McIlwaineSep 27, 2023Brass Contributor
- Norman_McIlwaineSep 27, 2023Brass ContributorI have been away for a while and I am just getting back into PQ again. I was trying to add a new entry in the table replacements and I find that I can not do this using PQ editor. I believe this is because when I open the table it is in preview mode. All that I can do is to view the data in the table. How can I edit the table to insert a new row ?
- Norman_McIlwaineSep 12, 2023Brass ContributorThanks for helping me out on this one. I was entering excel functions instead of M code functions. I must get a book on M code.
Thanks again. - SergeiBaklanSep 12, 2023MVP
I added
fnPayment = (str as text) => Text.Trim( Text.Combine( List.Skip( Splitter.SplitTextByCharacterTransition({"0".."9"}, {" "} )(str), (q) => Text.StartsWith(q, "PAYMENT -") and Text.Length(q) = 14 ) ) ),
into the body of query and replace texts with help of it.
- Norman_McIlwaineSep 12, 2023Brass Contributor
Thank you very much for the enhancements it looks fabulous. I have one problem which I have been working on all day.
Its how do I do a removal on a transaction without the use of the * or ? in a find and replace situation.
In Excel I could do a find and replace with find PAYMENT???????? replace with XXXXXXXXXXXXX.
Unfortunately without the use of * or ? in PQ it is difficult and I have tried some work arounds but all failed with errors.
I would like to change the transaction PAYMENT - XXXX with nothing leaving the remainder of the text in the field where this text appears in the transaction field.
Example
If transaction = PAYMENT - 1155 NEO FINANCIAL replace with NEO FINANCIAL.
The numeric value changes on every occurrence therefor, I tried to remove the first 15 characters PQ and got into a lot of errors. What would be your work around this statement?
If you could help me out I would appreciate it very much.
- SergeiBaklanSep 11, 2023MVP
I added the table in first sheet for the replacements
In second sheet is the list of accounts with added empty record
it is used for drop-down list in the reporting. Didn't transfer 4.51e+15 into long number and keep it as it is. Since in csv files it could be shown as 4.51e+15, 4.5140e+15, whatever. It looks like you open csv in Excel and save it on closing, thus account is saved as Excel transforms it.
Not critical, but to be safe better not to open csv in Excel such way. Better to allow legal connector in options
With that in new Excel file you may insert csv as Data->Get data->Legacy Wizard->From text and on third step set data type as Text for Account column
Above is assuming if 45000... was not converted on 4e+15 before.
Finally in Reports sheet added one returned by Power Query
you only need to refresh it if parameters were changed.
- Norman_McIlwaineSep 09, 2023Brass ContributorSorry Sergei, Of course the report is after you pass the transaction from PQ to excel run it through the Excel formula. I was not thinking as I am in the middle of moving houses as well as this project.
- Norman_McIlwaineSep 09, 2023Brass Contributor
It is looking very good and I am able to follow the M source for Transaction changes on the csv file. However i cannot see how the report is structured in the source code. If for instance, rather than type in and remember a16 digit account numbers I could have a pick box attached to the id field of the four account numbers. similar to the pick box I added to the Excel output.
The Total Income and Total expenses (which was a great after thought thank you) was a nice surprise in the report.
PETRO CANADA AND Esso are Gasoline and should be summed together if possible?
The Source in PQ is showing Petro Canada as 29.47 and the report shows 49.05 with only one Petro Canada entry in the Transaction field for the month = 8 could I be missing something in the source file for the month = 8.
If I could see the source for the report I perhaps could help.
Thanking you for any assistance.
- Norman_McIlwaineSep 09, 2023Brass ContributorThanks for the quick response, I will give a try.
- SergeiBaklanSep 09, 2023MVP
Tried to correct, please check in attached if I understood the logic correctly.
Query is within the file. On ribbon Data->Queries and Connections. Double click on right pane on query name to open it in Power Query Editor. Within it you may use Home->Advanced Editor to play with generated M-code.
- Norman_McIlwaineSep 09, 2023Brass Contributor
Thank you for looking at this for me, It does look good however I have noticed a few of the items that I require are not in the output and should have been moved from columns 5 to 6.
PENSON,
OLD AGE SECURITY
CPP,
PROV/LOCAL GOV PYMT,
ESSO CIRCLE K
OD INTERESTWhat I tries to do in Power Query was to remove all the entries that contain "IDP" in both columns by using the find and replace function. But I could never use a wild card like *IDP* to remove all the entries. Then I can move the above entries to the corresponding columns without any fear of losing important data. Then I can remove the columns that I do not require.
How to do this in Power Query I do not know. could you send me the Power Query inputs to achieve this output for my perusal then I might understand how power query works. I will send you the latest download to use.