Is it possible to replace blank cells in a Google Query with text? - google-query-language

I have built a table that uses SUM, COUNT, AVG using Google Query. It has a lot of blank cells because the data is missing. I want to see "N/A" in the blank cells. Is it possible to do this? Considering the query is aggregating numerical data and would spit out an error if I mixed data types?

try:
=INDEX(IF(QUERY(your_query_here)=""; "N/A"; QUERY(your_query_here)))

Related

Automatic S# column when using filter/query in google sheets

Here what i am trying to do
I want to automatically generate the serial number in the column while filtering. i tried to use below formula
=SUBTOTAL(3,$B$1:B)-1
Which is perfectly working for individually entered data.
but I want to apply the same function on a different sheet which is getting data by query formula and filtering it by different dropdowns.
oK I FIGURED IT OUT
i put 1 in the 1st raw of my data and put below formula to count as per shown results.
=IF(ISBLANK(B12),"",A11+1)
Thanks

google sheets query first row mess

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.

SSIS - Writing to Excel After Skipping Rows

Is there a way to write data to an excel spreadsheet after skipping x number of rows...excel is my destination and a sql query would be my source?
My scenario is one where i have a lot of header rows that i need to skip before data insertion. I would like to do this in an SSIS package. I am using SQL 2008 and Excel 2010.
Thanks
if you right click on the excel connection manager at the bottom of the page than click options , there is a setting called FirstRowHasColumnName set it to FALSE .let me know if it helps , didn't really understand if you just want to skip the first row that is the name of the columns from SQL query or more , there are other ways
Easiest way would be to modify your SQL query to exclude the header rows. If you can't do that then you need some logic to determine if the row is a header row (like checking if a certain field is a number):
If you can do that then you can do this:
read all columns in as text
Put in a derived column where you generate a new column IsHeader using your logic
Use Conditional Output to filter out the rows where your IsHeader is true
Use Data Conversion or Derived column to convert the columns to correct datatype
Output to Excel as usual

Concatenating Row Values in SSRS?

I'm trying to concatenate a particular record into one field to avoid multiple rows for the record. The issue is that a drive may contain multiple shifts in which each shift may be assigned a different vehicle.
Screenshot below shows what is happening:
Both records show the same drive, but the two shifts. I'd like to get the vehicles column to concatenate all vehicles into one field (Vehicles).
My attempt at an expression is:
=Fields!ShortDesc.Value & "," & Fields!ShortDesc.Value
Which obviously isn't working. Any suggestions on what to do to get this working correctly?
Easy solution would be to concat in database layer. See following question and answer. If you need to use SSRS solution, answer is running value function, an example here.

Correctly display the columns in a PivotTable

I have a pivot table in Excel. I have field headings on my other sheet I have got the date in them that correspond with a name.
When I make the pivot table all of the columns that have different amounts of data in them all show the same total. It is almost like it is counting the blanks.
Please look at the pictures and tell me if I am doing something wrong.
It probably is counting the blanks -- even though there is nothing in the cell, there may be formatting or other aspects that the pivot will include in the count. To fix this, you can either:
Filter your raw data and filter each column to just show the (Blanks). Highlight the entire column and press delete
Instead of "Yes" use 1. In your pivot instead of "Count" choose the value field setting of "Count Numbers"