Power Query null issues - excel

I am trying to create a custom column in power query that counts null values from column 7 - column 41. The function I have used is List.NonNullCount(List.Range(Record.FieldValues(),7,41))). There are many many rows of data so I would like it to calculate each row within the custom column.
For some reason even though each column between 7-41 has null values across the row the output is 2. I would expect the output to be 0. Futhermore I am getting an output of 35 when all columns from 7-41 have a value not equal to null across the row. I would expect 34 in this case. I did replace all blank values with null using the transform function in power query.
I'm not sure if my function List.NonNullCount(List.Range(Record.FieldValues(),7,41))) is correct or if there is a better way to do it. any help appreciated!!!!

In my version, you need to have an argument for Record.FieldValues. What you write: Record.FieldValues() would produce an error.
Also, the third argument of List.Range is the number of columns to return; it is not the number of the last column.
And the first column is column 0, not column 1
So something like:
List.NonNullCount(List.Range(Record.FieldValues(_),6,35))
should return the nonNull count for columns 7-41

Related

Why am I obtaining this strange result adding all the values in 2 Excel columns?

I am not into Excel and I have this problem trying to sum the values of 2 different column and put this result value into a cell.
So basically I have the D column containing 2 values (at the moment only 2 but will grows without a specific limit, I have to sum all the values in this column). These value are decimal values (in my example are: 0,3136322400 and 0,1000000000).
Then I have an I column containing the same type of value (at the moment only one but also the values in this column can grow without a specific limit...in my example at this time I have this value −0,335305)
Then I have the K3 cell where I have to put the sum of all the valus into the D column and all the values into the I column (following my example it will contain the result of this sum: 0,3136322400 + 0,1000000000 −0,335305.
Following a tutorial I tried to set this simple forumla in the K3 cell:
=SUM(A:I)
The problem is that in this cell now I am not obtaining the expected result (that is 0.07832724) but I am obtaining this value: 129236,1636322400.
It is very strange...I think that maybe it can depend by the fact that the D and the I column doesn't contain only number but both have a textual "heder" (that is the string "QUANTITY" for both the cells). So I think that maybe it is adding also the number conversion of this string (but I am absolutly not sure about this assertion).
So how can I handle this type of situation?
Can I do one of these 2 things:
1) Adding the column values starting from a specific starting cell in the column (for example: sum all the values under a cell without specify a down limit).
2) Exclude in some way the "header" cells from my sum so the textual values are not considered in my sum.
What could be a smart solution for my problem? How can I fix this issue?
The sum function can take several arguments.
=sum(d2:d10000, i2:I10,000, more columns )
This should remove the header from the calculation.
If you turn your data into an Excel Table (Insert > Table), you can use structured referencing to address a table column, excluding the header.
=SUM(Table1[This Header],Table1[That Header])
Then you don't need to reference whole columns. If you add new data to the table, the formula will take that into account.

Excel Array Formula, Multiple criteria

I have a table in which multiple weeks of data is stored and I'm trying to return a value based on 2 criteria.
Column A of the data sheet contains the date the report was ran (Always on the same day of the week - 24/05/17, 31/05/17 etc)
I've managed to return the value of column H by using an array formula, based on a cell value (Date) in ''Issues Data Quality Overview'!$B$4' using the following formula:
{=IFERROR(INDEX('Issues Log'!$H$1:$H$20000,SMALL(IF('Issues Data Quality Overview'!$B$4='Issues Log'!$A$1:$A$20000,ROW('Issues Log'!$A$1:$A$20000)-MIN(ROW('Issues Log'!$A$1:$A$20000))+1,""), ROW(A2))),"")}
That returns a value such as "IID-10225-22".
Problem:
Now I need to look up that value in the same table, based on a date in another cell, and return column X. (essentially adding the returned value as a criteria).
In all honesty I'm lost as to how I'd do this.
#Matthew. I understand your formula gives the list of values in column H with column A values matching 'Issues Data Quality Overview'!$B$4 in an ordered list.
Does your Issues Log, column H have multiple occurrence of the same value? (example: IID-10255-22 can have a value in Issues Log, column A that is not the same value as 'Issues Data Quality Overview'!$B$4).
If not, it doesn't make sense to use the result as a lookup value to get column X, you can simply change the code to:
{=IFERROR(INDEX('Issues Log'!$X$1:$X$20000,...}
If it does have multiple occurrences and you want to get the first occurrence of the result in column H and get the value in column X, best to add a formula right next to your array formula and do a VLOOKUP.
I've scrapped the array formula, as it really slowed down the processing speed. Instead I've created a Unique ID (=IssueID&Date) and VLookup'd that.

the result of calculated new column is not right

There is a table of 12 columns. I would like to add an extra column, where each entry stores the average value of the corresponding row across those 12 columns. I use the feature "Calculated new column" to fulfill this task. After getting the result, I noticed that the average value was returned as zero when one of the 12 columns has zero value on that specific row. For other rows, the calculation is just OK if none of the entries in those 12 columns is zero. I attached the screenshot of resulting table and the calculation procedure in the data table properties for your reference. Would you like to let me know the possible reason?
average value was returned as zero when one of the 12 columns has zero
Actually you don't have zero values, but null values, which is different! Use SN() function to manage null values (need to use for all the columns)!

Index match match - correct approach?

I have a data source in the format as the one below. In reality, that would contain few thousand rows.
I need to use something like INDEX-MATCH-MATCH in order to be able to get the "Status" for each "Content" item for each UserID.
The final result should look like this. The first two columns are not dynamic.
The INDEX formula goes to C and D.
I am using the following sequence to try and write the formula, but I don't seem to understand where the problem is.
=INDEX(Sheet1!A:K, [Vertical Position], [Horizontal Position])
look up the user with ID xxx:
=INDEX(Sheet1!A:K, MATCH(A2, Sheet1!A:K,0), [Horizontal Position])
look up the status for eLearn1.
=INDEX(Sheet1!A:K, MATCH(A2, Sheet1!A:K,0), MATCH("Status", Sheet1!A:K,0))
What am I doing wrong?
The question is not clear, but I think you are trying to do a LOOKUP based on the values of two columns. So for a particular value of Column A (UserID) and Column B (Content) you need to return Column H (Status).
This can be done using an array formula to return the row number of the matching line which can be fed into INDEX. Note, that this will only work as long as Columns A&B only have unique pairings.
I have set up some sample data:
Columns A-C are my source data. Cells G2:H4 are the lookup.
The formula is:
=INDEX($C$1:$C$7, SUM(($A$1:$A$7=$F2)* ($B$1:$B$7=G$1)*ROW($C$1:$C$7)))
This needs to be entered as an array formula by pressing CTRL-ALT-ENTER.
The formula works by matching the value you are searching for in both arrays and multiplying out the results. This should give you a result array consisting of all False with one True indicating the matched row. This is then multiplied against the row number to return the correct row to the INDEX formula.

Get first unique entry

I have the following three columns as data:
I am using the formula =IF(COUNTIFS($A:$A;A2;$B:$B;B2;$C:$C;C2)=1;1;0) as my output in the Output column. Basically I am giving a non-unique row a 0 and a unique row a 1.
However as you can see I want to give the first occurency of a unique combination of ART, Date and ISIN an 1 and the rest a 0. Why is my currently used formula wrong?
I appreciate your answer!
That's because your formula currently will put 1 for all unique rows and 0 for all duplicate rows, irrespective of whether they appear for the first time or not.
You can get the behaviour you're looking for by playing around a bit with the range lockings. For instance, you could try this:
=IF(COUNTIFS($A$2:$A2;A2;$B$2:$B2;B2;$C$2:$C2;C2)=1;1;0)
On the first row, the above formula will count only within the first row, so the result is bound to be 1.
When it reaches the second row, it will check the first 2 rows and will find that it's the same as the first one, so will return 2 as count and give you 0.
Notice how I locked the ranges: The first reference is completely locked $A$2:$A2 while the second one has the row variable $A$2:$A2.

Resources