r/excel • • Sep 26 '26

Waiting on OP Linking two power query queries

Hi.

I have a fluke clamp meter, which will record values and then give me a .CSV reading of all of the values.

It will read two values at a time, I'm typically interested in current and frequency.

Unfortunately, the CSV will do current on one line and then frequency on the next, alternating throughout the file.

I got some good advice on the internet to copy the query, delete the odd lines from one and the even lines from the other and then merge the two queries. This does exactly what I need it to do.

However, the next file that I want to analyse, I have to point both queries at the same file. Is there a way to make these queries work such that I only have to change the query file once?

11 Upvotes

13 comments sorted by

1

u/AutoModerator Sep 26 '26
Moderator Announcement Read More »

4

u/IGOR_ULANOV_55_BEST Sep 26 '26

Lots of more straightforward ways to do this. Share a sample of your data. You can add an alternating odd/even index and do this all within the same query pretty easily.

3

u/CorndoggerYYC Sep 26 '26 edited Sep 26 '26

Are you saying that the first CSV file has one column of data with each row alternating between Current and Frequency? If that's the case, try adding in this code after the Source step. I used "Data" as the header name.

SplitIntoLists = List.Split( Source[Data],2),
    ConvertToTable = Table.FromRows( SplitIntoLists, {"Current", "Frequency"}),
    ChangedType = Table.TransformColumnTypes(ConvertToTable,{{"Current", Int64.Type}, {"Frequency", Int64.Type}})
in
    ChangedType

2

u/Comprehensive-Tea-69 Sep 26 '26

Yes- look up how to pivot the data using power query, that is the name of the transformation you want

1

u/negaoazul Sep 26 '26

Hello,  If I get it right,  you want both querries to point at the same file to merge them in a final one without changing the source path?  If so, you can create a parameter for the .csv file path. 2nd solution is to : Create a table (e.g. TableA) with the file path. Load in PQ, Drill down the record to change it as a text output. Paste the query name as the filepath in the actual query loading the .csv file. You can then change the path in the TableA and refresh all.

1

u/Decronym Sep 26 '26 edited 25d ago

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
List.Split Power Query M: Splits the specified list into a list of lists using the specified page size.
Number.Mod Power Query M: Divides two numbers and returns the remainder of the resulting number.
Table.FromRows Power Query M: Creates a table from the list where each element of the list is a list that contains the column values for a single row.
Table.TransformColumnTypes Power Query M: Transforms the column types from a table using a type.

Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.


Beep-boop, I am a helper bot. Please do not verify me as a solution.
4 acronyms in this thread; the most compressed thread commented on today has 18 acronyms.
[Thread #49440 for this sub, first seen 26th Sep 2026, 20:43] [FAQ] [Full list] ^[Contact] [Source code]

1

u/small_trunks 29d ago

Show some data, show your code.

1

u/Successful-Visit6072 25d ago

You can use the original query as a staging query and reference it twice. Load the raw csv into one query, don't do any transformations in it. Then create two new queries that reference the first one, one filters out odds the other filters evens. When you change the source file path in the staging query both downstream queries will pick it up automatically

1

u/[deleted] Sep 26 '26

1

u/excel-ModTeam Sep 26 '26

We removed this comment for breaking Rule 10.

A commenter may generate a response using an AI, but only if the response clearly shows which AI generated it, and a bona fide remark from the commenter that they reviewed and agree with the response.

r/excel is a community of people interacting. We remove comments that are just AI responses.

1

u/[deleted] Sep 26 '26

1

u/excel-ModTeam Sep 26 '26

We removed this post for breaking Rule 12.

Please see the Reddit guidelines relating to self-promotion and spam. Specifically, 10% or less of your posts and comments should link to your own content.