google sheets query first row mess - csv

I am designing a workflow at work to streamline some tasks. I get some CSV from a database which I want automatically added to a Google Sheet. I stored it on a Google Drive, got the direct download link and used it with IMPORTDATA on sheet1. So far so good.
The final aim is to create a good way to visualize which rows meet specific conditions, so I thought using a PivotTable might be handy. However, to filter out some of the uninteresting rows, PivotTables are not the way to go, since the filters are quite poor (no possibility of basic filter criteria like =, !=, <, >, etc). So I thought about populating a second sheet with a Query function (with the filtering statements) so that the PivotTable generates a report directly from a filtered source.
The issue (apart from the lag) is that sheet 2 (the one with the query) shows a strange output: the first row, that should contain only the column labels, mixes up the column labels with the value of the cell below them. It is quite baffling. Moreso because it does not happen all along row 1, but it only appears to do so on the first seven columns. So insted of A1 showing "event_id", it actually shows "event_id 106727", which is the value of the fisrt event that should go on A2.
Any thought why this happens?I already checked and there does not seem to be anything wrong with the CSV.
If yyou also have a suggestion of why this whole setup would be a bad idea, please also tell me :P
Thank you!

The query command combines multiple header rows into one. And sometimes it mistakes your data for headers. To avoid this, use the optional third parameter to specify the number of header rows:
=query(range, query_string, 1)
(if there is one header row).

The approach by #user6655984 did not work for me, because I was already using the third parameter to customise my header usage.
What occurred was that I was performing 12 queries to different sheets with similarly data. One column was a mixture of strings, such as "12 FPS", "14fps", and numbers. When I began working my way through these columns on all the sheets, I was left with mostly numbers, with a few strings spread throughout.
This caused my query to create a massive first row which concatenated the results of about 6 rows together, cell by cell, before showing the rest of the results, where in this column I edited, all the strings had been removed.
By happenstance I saw this one person here who talked about fixing a query issue by making sure that they type-converted the information in a column to be consistent.
This led me to find the following Google support forum post, about queries and data types, from 2019: Query function not working with specific data set (but working with others)
Giving this a go, I tried turning all the data in all the columns that were equivalent to each other in each sheet I was querying into numbers fixed the issue. Try this if setting headers is not working; make sure you don't have silent type errors.

Related

SSRS (MS Report Builder) - How do I add multiple lines of queried details to a single row of otherwise more general info?

I've been trying to figure this out, but I'm struggling.
Working in Microsoft Report Builder (latest version), I have a table that, for the most part, contains general information from a specific table, which I'll call GeneralInfo. In that table, each person has only a single row containing information about that person. However, one of my columns has a one-to-many relationship with the rest of the row. I'll call this other column DetailInfo.
This table provides an example of the kind of thing I'm going for:
In this example, all of the white cells come from the GeneralInfo table. The Orange cell may include many rows of work history, and each entry includes multiple elements from the DetailInfo table, separated by Newlines. The two tables can be matched / joined on the ID value.
This may not be the best way to go about a report, but it's part of the spec I was given. I know this can be done, but I'm having trouble learning how. Can anyone help me out?
Edit - I just found out that another column is also potentially one-to-many. In the example table, it would be saying that the "Occupation" value comes from the DetailInfo table, rather than the GeneralInfo table.
In MOST circumstances, this would just be "Construction Foreman" over and over again, and we would only want to show that once. However, in rare circumstances, an individual may have multiple concurrent (differing) Occupation values that would have to be shown. Is that possible? Should I make that a separate question?
I took Soundappan A's advice and created a sub-report in the column that needed the extra data. This video was helpful to me in learning how to set that up:
https://www.youtube.com/watch?v=LhSitVAnhyc

Auto Sorting Sheets Based on Values

I'm creating a rudimentary inventory tracking system. I first want anything with a value greater than zero to appear at the top of the sheet (current inventory), and then I want all of those rows to be "sub-sorted" alphabetically. I successfully auto-sorted my sheet by two separate columns using the script in this link:
https://www.idiotinside.com/2018/06/08/sort-multiple-columns-google-sheets-apps-script/
However, I want one of the columns to be sorted by a value (greater than zero). I've been searching the stacks and haven't found anything related. I searched the script library, as well, but new to this, so may not have searched properly.
Any help much appreciated!

Spotfire: Using Multiple Markings in a Data Function Without Needing Something Marked in Each

In Spotfire I have a dashboard that uses both filtering (only one filtering scheme) and multiple markings to show the resulting data in a table.
I have created a data function which takes a column and outputs the data in the column after the active filtering scheme and markings are applied.
However, this output column is only calculated if I have something marked in every marking.
I want the output column to be calculated no matter how many of the markings are being used. Is there a way to do this?
I was thinking I could use an IronPython script to edit the data function parameters for my input column to only check the boxes for markings that are actively being used. However, I can't find how to access those parameters with IronPython.
Thanks!
I think it would be a combination of visuals being set to OR instead of AND for markings (if you have a set of markings that are being set from others).
Also are all the input parameters set to required parameter perhaps unchecking that option would still run the script. In the r script you may want to replace null values as well.
Not too sure without some example.

Compare one column in excel to another column in excel and find duplicate values

I was just wondering if there was an easy way in Excel to complete the following task:
In my Excel spreadsheet I have two tabs. One tab represents one database and the other tab represents a different database. I have a column of data that is 1500+ rows long from my first database(tab) that looks like this:
In the other tab, I have another column that is similar to the above column. My goal is to be able to compare the above column to the other column in the separate tab, and search for duplicate values.
So for example the first code in the above column is 00064. It would search the specified column in the separate tab for the code 00064. If it finds it I would need to be alerted or have it logged somehow. Then it would move on to the next code, 00368 and repeat the process for every cell inside that column. I hope this makes sense. Please feel free to ask any questions you may have for further clarification.
My desired outcome is to ween out the duplicate values but I am not sure how to go about this because due to the length of my columns, manual comparisons would take quite some time. If there is a macro that could accomplish this it would make my life so much easier.
I greatly appreciate any help that can be offered.
Thank you!
-Dave
No need for VBA here. In the first cell of your second column (B1) of your first tab use a countif formula:
=countif(tab2!A:A, A1)
Copy this formula down so it is next to every populated cell in Column A. This will return the number of records in Tab2 that are equal to A1 in your first tab. Look for anything > 0 to find things that have a match, or things > 2 for duplicates.
You can extend this with an if statement like
=if(countif(tab2!A:A, A1)>2, "Duplicate", countif(tab2!A:A, A1)=1, "Only one Match", "No Match"))
This does not require the use of a macro. I would use a VLOOKUP formula. If an exact match is found between the columns it will return the columns value. If no match is found the cell will read #N/A.
An example of the formula that compares the cell A1 on Sheet1 to the column A on Sheet2 looks like this:
=VLOOKUP(A1,Sheet2!A:A,1,)
Here is documentation on how to use this formula.

'un-merge' multiple nested column headers in a matrix chart

I have spent far too long on this and would really appreciate any help someone is able to give. I am creating a cross tab type report in SSRS (2012) using a matrix. Everything is working fine - however my end result must have each column separated from the next (i.e. no merging on common groups). I have three nested groups for the column groups (see figure) and want the output to show individual columns as opposed to merged on common groups.
I have seemingly exhausted all options - and am absolutely stuck - is anyone able to help?
Forgive - I found by adding grouping appropriate to my report and then deleting the row and inserting rows inside the group and re entering the values worked. These appear as 'static' in the advanced mode setting.