how to convert table columns to one new column - azure

i´m having a table in Azure Data Explorer like this:
OperationsId
name
resultCode
duration
1234
httprequest1234
200
79,3
5678
httprequest5678
200
11,5
I would like to now summarize now by OperationsID, but than having all remaining items which corresponds to this operationsID in a new column like this:
OperationsId
Details
1234
{"name": "httprequest1234", "resultcode":200, "duration":79,3, ....}
5678
{"name": "httprequest5678", "resultcode":200, "duration":11,5, ....}
doesn´t have to be JSON, but is there a way to convert a table or multiple columns of a table to a new column?
Thanks

datatable (OperationsId:long, name:string, resultCode:int, duration:real)
[
1234 ,"httprequest1234" ,200 ,79.3
,5678 ,"httprequest5678" ,200 ,11.5
]
| project OperationsId, Details = bag_remove_keys(pack_all(), dynamic(["OperationsId"]))
OperationsId
Details
1234
{"name":"httprequest1234","resultCode":200,"duration":79.3}
5678
{"name":"httprequest5678","resultCode":200,"duration":11.5}
Fiddle

Related

Replacing Null Values with Mean Value of the Column in Grid DB

So, I was working with GridDB NodeJs Connector, I know the query to find out the null values which shows the records/rows:
SELECT * FROM employees where employee_salary = NaN;
But I want to replace the null values of the column with the mean value of the column, in order to maintain the data consistency for data analysis. How do I do that in GridDB?
The Employee table looks like the following:
employee_id employee_salary first_name department
---------------+---------------+--------------+--------------
0 John Sales
1 60000 Lisa Development
2 45000 Richard Sales
3 50000 Lina Marketing
4 55000 Anderson Development

Node Postgres: How are key names constructed for a join query result

The Node Postgres docs do not indicate what to expect for the key names in a query with joined tables.
Does anyone know if it would it be a concat of the table and column names, something like this:
[
{
"user.id": "100",
"user.name": "james",
"campaign.id": "5201",
"campaign.budget": "5000"
}
]
Or do you need to specifically alias each table name (below example assumes u/c to clear ambiguities, and budget is returned with no table prefix)?
[
{
"u.id": "100",
"u.name": "james",
"c.id": "5201",
"budget": "5000"
}
]
Fortunately, I am also using npm pg module, So maybe I can help here
If both the columns have the same i.e. table1 and table2 contains both a column budget then in the query you have to reference it by table1.budget and table2.budget but in the response, you will get budget as the column name.
The response can contain of the budget value either of table1 or table2 with key name budget
And if you refer the budget column without table name you will get an error, as Postgres will not know which table's budget to refer to.
If you want both of the column names then you can use aliases AS
SELECT table1.budget AS table1_budget,
table2.budget AS table2_budget, <other coulmns>
FROM table1
INNER JOIN table2 ON <Join Condition>

powerquery : combining two tables for each data

i have two tables
one includes dates (table1)
Date
11/10/2019
11/17/2019
the other one has names (table2)
Name Surname
xxxxxx
yyyyyy
i want to combine the second table for each data in the table1
result should be
Name Surname Date
xxxxxx 11/10/2019
yyyyyy 11/10/2019
xxxxxx 11/17/2019
yyyyyy 11/17/2019
i am sure it is very for you guys,
thanks for the help,
It's quite easy:
= Table.Join(table2,{},table1,{})

Excel - Help Needed with Formulas

I'm looking to try do the following;
I want to have say 3 columns.
Transaction | Category | Amount
so I want to be able to enter a certain Name in Transaction say for argument sake "Tesco" then have a returned result in Category Column say "Groceries" and I can enter a specific amount then myself in Amount Colum.
Thing is I will need to have unlimited or quite a lot of different Transactions and have them all in pre determined Categories so that each time when I type in a Transaction it will automatically display the category for me.
All help much appreciated.
I know a simple If Statement wont suffice I can get it to work no problem using a Simple IF Statement but as each Transaction is different I don't know how to program further.
Thanks.
Colin
Use a lookup table. Let's say it's on a sheet called "Categories" and it looks like this:
| A | B
1 | Name | Category
2 | Tesco | Groceries
3 | Shell | Fuel
Then, in the table you describe, use =VLOOKUP(A2, Categories!$A$2:$B$3, 2, FALSE) in your "Category" field, assuming it's in B2.
I do this a fair bit using Data Validation and tables.
In this case I would have two tables containing my pick lists on a lookup sheet.
Transaction Table : [Name] = "loTrans" - with just the list of transactions sorted
Category Table : [Name] = "loCategory" - two columns in table, sorted by Both columns - Trans and Category
Header1 : Transactions
Header2 : Category
The Details Table:
the transaction field will have a simple data validation, using a
named range "trans", that selects from the table loTrans.
the transaction field will also use data validation, using a named
range, but the source of the named range ("selCat" will be a little more
complex. It will be something like:
=OFFSET(loCategory[Trans],MATCH(Enter_Details!A3,loCategory[Trans],0)-1,1,COUNTIF(loCategory[Trans],Enter_Details!A3),1)
As you enter details, and select different Transactions, the data validation will be limited to the Categorys of your selected transactions
An example file

excel merge separate columns into rows

I have this data in excel
I have a spreadsheet with data like this:
Username GroupName Output
jsmith 1234 jsmith1234
mdean 2345 jsmith2345
kjack 3456 jsmith3456
4567 jsmith4567
mdean1234
mdean2345
mdean3456
mdean4567
kjack1234
kjack2345
kjack3456
kjack4567
I want to know if there is a function to create the output based on this set of data. The Username could be more than GroupName or vice-versa.
Try
=IF(ROW()-ROW($C$2)+1>COUNTA(A2:A)*COUNTA(B2:B),"",INDEX(A2:A,INT((ROW()-ROW($C$2))/COUNTA(B2:B)+1))&INDEX(B2:B,MOD(ROW()-ROW($C$2),COUNTA(B2:B))+1))
Pulled from: http://www.mrexcel.com/forum/excel-questions/654871-how-generate-all-possible-combinations-two-lists-without-macro.html

Resources