MS PowerQuery finding differences between columns and returning them in another columns - powerquery

I need to find out differences between columns were my students are putting their answers and i want to check those answers against the right answers using PowerQuery.
example:
Any idea how to achieve that?

Related

Is there a way to hide the total sum from a single column in a data table on Kibana?

I created a data table containing several columns: most of them must show the total of their respective values. I’m just wondering if there’s a way to selectively hide this sum, since the latest column includes an average of ratings and it doesn’t make sense to have a sum of them.
Below, an example of what I’d like to achieve if it’s possibile:
Basically, I need to hide the number deleted in red. I know that there could be plugins to do so, but I don’t know if I can ask to install one or more.
Thanks in advance.

How to create a DAX cross-sectional measure?

I don't know if I even worded the question correctly, but I'm trying to create a measure that depends on what is showing in the pivot table (using PowerPivot). In the image I posted, "DealMonth" is an expression in the PowerQuery table itself that simply takes the start date of the employee and subtracts it from the month a deal was closed in. That will show how long it took for that salesperson to close the deal. "TenureMonths" is also an expression in the PowerQuery table that calculates the tenure of the person. The values populating this screenshot are coming from a total headcount measure created. What I'm trying to do is create a separate measure that will show when the "TenureMonths" is less than the "DealMonth." So if the TenureMonths is 5, then after DealMonth of 5, the value would be 0. Is this possible?
Screenshot
I should add the following information.
"DealMonth" - Comes from the FactData table
"TenureMonths" - Comes from the DimSalesStart table
These two tables are joined by name. I feel like I'm so close because I can see what I want. The second image below is a copy/paste of the pivot table result but with my edits to show what I'd want to have shown. Basically, if(TenureMonths >= DealMonth,1,0). The trouble seems to be that since they're in two different tables, I can't make it work. The rows in the fact table are transactions, but the rows in the dim table are just the people with their start and end dates.
Desired Result
This is possible with some IF([measure1]<[measure2],blank(),[measure1]), however without seeing more of the data it will be hard to guide you specifically.
However you need to create two separate measures, one for TenureMonths and one for DealMonth, depending on the data this can be done with an aggregator forumla such as sum, min, max, etc (depends if there will be more than one value).
Then reference those two measures in the formula pattern I mentioned above, and that should give you want you want.
I figured out a solution. I added a dimension table for DealMonth itself and joined to my fact table. That allowed me to do the formulas that I needed.

Google Sheets Query Sorted Results

I am writing a query function that I would like sorted. I have this figured out. What I cannot solve is attempting to insert 2 blank rows between the sorted results. Is this at all possible? Here is my query as it currently stands. Works perfectly as written. Just would like to have a 2 row gap between results.
Thank you.
=query('Form Responses 1'!A:CM,"Select B,C,D,I,L,AU,AX Where K = '"&Titles!B2&"' OR AW = '"&Titles!B2&"'Order by K,AW",0)
enter image description here
Since you've clarified your question to say that you want two blank rows, only to be added at a specific point in your query results, I've created another answer. But you haven't answered my question about what criteria you have for deciding where to insert these two lines, so I've made an assumption based on your data. This formula should be easily adapted if you have some other criteria for where to insert the blank lines. See my added tab HelpGK in yur sample sheet.
Try this formula, where you have your query:
={query('Data Sheet'!A:J,"Select B,C,D,E,F,H,I Where E='' and (G = 'ABC' OR J = 'ABC') Order by J,G",0);
{"","","","","","",""};
{"","","","","","",""};
query('Data Sheet'!A:J,"Select B,C,D,E,F,H,I Where E<>'' and (G = 'ABC' OR J = 'ABC') Order by J,G",0)}
Note that I don't believe your exact Desired Result can be obtained from your Data sheet. You are missing data rows. But this formula produces the result in the screenshot you provided.
EDIT:
Just realised that I created an answer for a single column of data.
Please share a sample sheet since this is not your case.
You can try this formula, but you'll need to replace this text "A4:A8" with your exact query:
=ArrayFormula(flatten(split(A4:A8 & "♥ ♥ ","♥",0,0)))
Note that the column with the "~" values in the blank cells is just to demonstrate what is happening.
If you had provided a sample sheet, with sample data, it would have been easier.
Let me know if this works for you. If not, please provide a sample sheet, with sample data, and let us know what else you need.
Be aware that the you can't put any values into the two inserted rows of blank cells, or the arrayformula will fail. But if you are planning to save the results of this as values, then pasted into place, then you could overwrite the blank cells, if desired.
Also be aware that FLATTEN is an undocumented function, and may possibly be removed from Sheets. If this is for a critical application, and alternative formula can be provided. Let us know if that is a concern.
I will delete my earlier answer, which mistakenly focused on a one column result.
This messy formula seems to handle multiple columns. If it works for you, I'll see if I can simplify it or clean it up. I can also provide details of the steps it is doing, if necessary. Replace the text "A4:C8" in this formula with the range where your query result currently exists. Once you've tested that, you can replace the text "A4:C8" with your actual query statement, to have everything done in one formula, if you want.
=ARRAYFORMULA(SUBSTITUTE(SUBSTITUTE(SPLIT(FLATTEN(ARRAYFORMULA(SPLIT(TRANSPOSE(ARRAYFORMULA(QUERY(TRANSPOSE(ARRAYFORMULA(SUBSTITUTE(A4:C8," ","♥"))),,99^99)&"♦~♦~")),"♦",1,0)))," ",1,0),"~",""),"♥"," "))
Please let me know if this works for you. If you have any issues, please share a sample sheet, with only sample data, and clarify what isn't working as you expect.

Filter Data for Each Row in a Column

EVE Online Manufacturing Spreadsheet
In Batch!F3:G, I'm attempting to break down the data input from columns B3:C to their components (and eventually materials/minerals in I3:J) by using filter to compare results in Engine!P:R. Multiplied of course by the total number of each finished product I need.
I've been trying to figure out ways to arrayformula this together, and even tried quite a few query functions without success. The best I've been able to come up with is to string the actual formula together, appending them with {}, but this gets bloated quickly. I need this to be open ended because I have a tendency to build a lot of things at once. Any help would be appreciated, even just point me in the right direction!
Well, based on my limited knowledge about google sheet, I can only think of one way to do this automatically.
Here's a sheet I constructed based on your sheet.
https://docs.google.com/spreadsheets/d/1AfX8o05gUGPiN5S90w4o0yxuIYjsJRaXsaYUFTJuEPo/edit?usp=sharing
First, on Engine sheet, add one more column which will give you the number of materials required for that part, which is looked up in the PART LIST of BATCH sheet. For this I use VLOOKUP, as you see in D2.
Then on BATCH sheet, query the materials that VLOOKUP return positive, multiply it by the amount of item and then sum them.
This is done by the QUERY used in F3
This method only if you don't have duplicate item in your PART LIST, due to the way VLOOKUP work.
Of course if you want to break the material list further, you can do the same approach..

Pasting a smaller number of columns than selected duplicates data

I tried to search for a similar question but did not find it - I think it may be out there and any help is appreciated.
I have a simple handsontable implementation - the issue only appears when you copy a certain number of columns from excel, 2 for example, and the paste into handsontable where a larger number of columns has been selected (say 10).
It happens even in standard handsontable examples such as the example pasted here.
All I did was select all the records, delete them and then select an entire row and pasted two columns. As you can see the data was duplicated for the following columns sample table.
Has anyone seen this before?
Is there a solution I am obviously missing?

Resources