QUERY + IMPORTRANGE : Did I reached a limit of 999 rows? - google-sheets-formula

Issue with an incomplete import in google sheet
Following this thread :
VLOOKUP + QUERY + IMPORTRANGE > import all lines with condition true
I have a list of spells that today exceeds 1010 items.
The source data is imported in different spreadsheets with the following formula that does work : =ARRAYFORMULA(IFNA(VLOOKUP(A3:A; QUERY({IMPORTRANGE(A1; I1)}; "select Col2,Col1,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15 where Col1=TRUE"; ); {3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15}; )))
However, I reach a limit at row A1001 ; the following wont get filled with any data even though the remaining items in the source data followed the query rules.
I import a table of 15 columns, so I was wondering if there was a limit of 15*1000 cells in google sheet and if so, what was the best way of getting the extra rows.
Thanks !

Try inserting in Sheet 2 the full QUERY:
=QUERY({IMPORTRANGE(Sheet1!A1;Sheet1!I1)}; "select Col2,Col1,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15 where Col1=TRUE"; )
(PS: I'm guessing your first sheet is called Sheet1, please check it)
And in Sheet1 you can use FILTER:
=BYROW(A3:A,LAMBDA(each,IFNA(FILTER(Sheet2!B:O,Sheet2!A:A=each))))
Let me know!

Related

Business Objects 4.x: need to combine two queries similar to a UNION

I can't seem to figure out how to combine the result of 2 Business Objects queries.
Both queries return a set of codes and a number of hours. Query 1 can have codes that do not appear in Query 2, and Query 2 can have codes that do not appear in Query 1.
The resulting report should contain all codes from both Query 1 and Query2, a column with the sum of hours from Q1 for that code, and a column with the sum of hours from Query 2 for that code. If one of the queries doesn't have a code in it, it would return a blank or 0 total.
Example:
Q1 results:
|Code|Value|
|:---|:----|
|A|15|
|A|17|
|B|12|
|D|22|
|D|35|
|E|16|
|E|9|
|E|11|
Q2 results:
|Code|Value|
|:---|:----|
|A|5|
|A|19|
|B|33|
|C|17|
|C|24|
|E|78|
|E|12|
Report:
|Code|Value1|Value2|
|----|------|------|
|A|32|24|
|B|12|33|
|C| |41|
|D|57| |
|E|36|90|
|Total|137|188|
When I create the Business Object report table as normal, only the values of Query 1 are used, and I miss the row for value C. If I flip the queries around, I miss the row for value D.
How do I set up my report to show all the code values?
Edit: Sorry for the formatting of the tables, in the preview it looks perfect. :(

Google Sheets - Find and match value with filter

I have try using query, vlookup and filter to get data from other tab sheets
I don't know how to get data with logic condition.
Here my sheets :
https://docs.google.com/spreadsheets/d/1sukCRlU1UuXS6IaR8xCYs8QScH4B2m60bqsrypDkzTM/edit?usp=sharing
Step 1 :
I have tab sheet with list of reward
Step 2 :
in the other tab sheet (cust_point), in column C i want to get value from tab sheet Reward where it use match and logic condition >= and <=.
Then here my expectation :
Problem :
First, i try with formula
=QUERY(Reward!A2:B, "SELECT A WHERE B <= '"&C2&"'", 1)
then the result just showed but doesn't match
Second, i try with formula
=FILTER(Reward!A2:B,C2>=Reward!B2:B)
Third, i try with formula
=IF(VLOOKUP(C2,Reward!B2:B,1,FALSE), C2>=Reward!B2:B)
They all formula doesn't get value with match data like my expectation
How can I achieve that?
use:
=ARRAYFORMULA(IFNA(VLOOKUP(10000-B2:B;
SORT({10000-Reward!B2:B\Reward!A2:A}); 2; 1)))

How to create a measure to count the number of times item appears in a filtered list (power BI, DAX)

Hi, I would like to create a measure in power BI to return the number of times the terminal code appears in my list. The list is filtered from a slicer when I select the service code.
Thanks for any help! been stuck at this seemingly simple problem for a few days!
If you want to count occurence in selected filter context then use ALLSELECTED:
CountOfCode = CALCULATE( COUNTROWS(Sheet1), filter(ALLSELECTED(Sheet1), Sheet1[Terminal Code ] = SELECTEDVALUE(Sheet1[Terminal Code ]) ))

MDX Query with Crossjoin and Filter Times Out

I keep timing out every time I try to run this query. It seems to work until I add in the "([Finished Product].[Primary].MEMBERS," section into the rows section of the query. Any ideas?
SELECT NON EMPTY {[Measures].[Retailer Event Margin Pcnt (Actual, WB Total, LE)], [Measures].[Incr Cnsmp Units (Actual)]} ON COLUMNS,
NON EMPTY {[Finished Product].[Primary].MEMBERS * [Promotion Plan].[Promotion Plan].[Event].MEMBERS}
HAVING LEFT([Promotion Plan].[Promotion Plan].CurrentMember.Name, 6) = "Anchor" ON ROWS
FROM [PEA]
WHERE ( [Time].[Fiscal].[Fiscal Year].&[2017] )
Try the "nonempty" key word , which evaluated the set on axis level, "non empty" is evaluated on top of the query which may have a performance issue for a large set.
nonempty(
nonempty([finished product].[primary].members,[your measure])*[promotion plan].[promotion plan].members,[your measure])
It just a reference, and you need do some changs on it for your case.
hope it helps.
MDXHelper : IDE to Write, Analyze, Tuning, Debug MDX efficiently
Try filtering before the Crossjoin:
SELECT NON EMPTY {[Measures].[Retailer Event Margin Pcnt (Actual, WB Total, LE)], [Measures].[Incr Cnsmp Units (Actual)]} ON COLUMNS,
NON EMPTY [Finished Product].[Primary].MEMBERS
* Filter([Promotion Plan].[Promotion Plan].[Event].MEMBERS, LEFT([Promotion Plan].[Promotion Plan].CurrentMember.Name, 6) = "Anchor")
ON ROWS FROM [PEA]
WHERE ( [Time].[Fiscal].[Fiscal Year].&[2017] )

Max/Min for whole sets of records in PIG

I have a set set of records that I am loading from a file and the first thing I need to do is get the max and min of a column.
In SQL I would do this with a subquery like this:
select c.state, c.population,
(select max(c.population) from state_info c) as max_pop,
(select min(c.population) from state_info c) as min_pop
from state_info c
I assume there must be an easy way to do this in PIG as well but I'm having trouble finding it. It has a MAX and MIN function but when I tried doing the following it didn't work:
records=LOAD '/Users/Winter/School/st_incm.txt' AS (state:chararray, population:int);
with_max = FOREACH records GENERATE state, population, MAX(population);
This didn't work. I had better luck adding an extra column with the same value to each row and then grouping them on that column. Then getting the max on that new group. This seems like a convoluted way of getting what I want so I thought I'd ask if anyone knows a simpler way.
Thanks in advance for the help.
As you said you need to group all the data together but no extra column is required if you use GROUP ALL.
Pig
records = LOAD 'states.txt' AS (state:chararray, population:int);
records_group = GROUP records ALL;
with_max = FOREACH records_group
GENERATE
FLATTEN(records.(state, population)), MAX(records.population);
Input
CA 10
VA 5
WI 2
Output
(CA,10,10)
(VA,5,10)
(WI,2,10)

Resources