How to add a custom column which will get data from a row

%3CLINGO-SUB%20id%3D%22lingo-sub-778849%22%20slang%3D%22en-US%22%3EHow%20to%20add%20a%20custom%20column%20which%20will%20get%20data%20from%20a%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778849%22%20slang%3D%22en-US%22%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EFollwing%20query%20gives%20values%20from%20multiple%20performance%20counters%20but%20in%20a%20different%20rows.%20Is%20it%20possible%20to%20add%20performance%20counter's%20value%20in%20columns%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPerf%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3EObjectName%20%3D%3D%3C%2FSPAN%3E%3CSPAN%3E%22Memory%22%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3ECounterName%3D%3D%3C%2FSPAN%3E%3CSPAN%3E%22%25%20Committed%20Bytes%20In%20Use%22%3C%2FSPAN%3E%3CSPAN%3Eor%3C%2FSPAN%3E%3CSPAN%3ECounterName%3D%3D%3C%2FSPAN%3E%3CSPAN%3E%22%25%20used%20memory%22%3C%2FSPAN%3E%3CSPAN%3Eor%3C%2FSPAN%3E%3CSPAN%3ECounterName%3D%3D%3C%2FSPAN%3E%3CSPAN%3E%22Available%20MBytes%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3EAvg_Memory_Usage%3Davg(CounterValue)%20%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3EComputer%2C%20CounterName%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Erequired%20output%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EComputer%2C%20Available%20Memory%2C%20%25committed%26nbsp%3Bmemory%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Exyz%2C%203000%2C%2020%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-778849%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECustom%20Logs%20and%20Custom%20Fields%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQuery%20Language%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-781523%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20add%20a%20custom%20column%20which%20will%20get%20data%20from%20a%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-781523%22%20slang%3D%22en-US%22%3E%3CP%3EMay%20we%20be%20we%20can%20create%20a%20temp%20table%20and%20join%20the%20two%20data%20sets%20to%20have%20perf%20counter%20values%20in%20columns%20instead%20of%20row.%20If%20someone%20could%20help%20give%20an%20example%20of%20that%20may%20also%20help%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F384192%22%20target%3D%22_blank%22%3E%40samer87%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-787744%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20add%20a%20custom%20column%20which%20will%20get%20data%20from%20a%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-787744%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F384192%22%20target%3D%22_blank%22%3E%40samer87%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20store%20the%20results%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fletstatement%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ELet%3C%2FA%3Estatement%20-%20note%2C%20all%20three%20lets%20must%20return%20data%20for%20this%20to%20work%20-%20thats%20why%20I%20have%20commented%20out%20two%20lines%20as%20I%20don't%20have%20%22%25%20used%20memory%22%20data%20in%20the%20workspace%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.loganalytics.io%2FDemo%3Fq%3DH4sIAAAAAAAAA6WRTWrDMBCF9wLd4WEo2BDIAYoWaVZdpO0m3cvxNFWinyDLLi45fKW4tet4E8jspJn53psZTQE7Z4wKVD11gWoI5G%252FkPzg74%252BuTPOG1PNAuvEhDECLbkHG%252ByyBthbVrbCCfUjHzEN8JFEnoUc8W25qyhKobY6RX34RVu1%252F%252FFxSy3ee%252FpHepGypQdgl1auJP8ciZjh6bmqpe%252Bh6DiQLTF8xcbQeJ2yzJViotS0137m31x8HmQpo7u1TcuKzpMTlbLs84OGVxVLYSylryyMdtFkjh7MBAUp81TGctZg0n79Kww%252BeCMwxxffFFcjVJj6u%252FbhxH5%252BwH0GK3GawCAAA%253D%26amp%3Btimespan%3DP1D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EGo%20to%20Log%20Analytics%20and%20Run%20Query%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Elet%20commitedBytes%20%3D%20(Perf%0A%7C%20where%20ObjectName%20%3D%3D%22Memory%22%20and%20CounterName%3D%3D%22%25%20Committed%20Bytes%20In%20Use%22%0A%7C%20summarize%20AvgCommitedBytes%3Davg(CounterValue)%20by%20Computer)%3B%0Alet%20usedMemory%20%3D%20(Perf%0A%7C%20where%20ObjectName%20%3D%3D%22Memory%22%20and%20CounterName%3D%3D%22%25%20used%20memory%22%0A%7C%20summarize%20AvgUsedMemory%3Davg(CounterValue)%20by%20Computer)%3B%0Alet%20availableBytes%20%3D%20(Perf%0A%7C%20where%20ObjectName%20%3D%3D%22Memory%22%20and%20CounterName%3D%3D%22Available%20MBytes%22%0A%7C%20summarize%20AvgAvailBytes%3Davg(CounterValue)%20by%20Computer)%3B%0AcommitedBytes%20%0A%2F%2F%7C%20join%20kind%3Dinner%20(usedMemory)%20%20%20%20%20on%20Computer%20%0A%7C%20join%20kind%3Dinner%20(availableBytes)%20on%20Computer%20%0A%7C%20project%20Computer%2C%0A%20%20%20%20%20%20%20%20%20%20AvgCommitedBytes%2C%0A%2F%2F%20%20%20%20%20%20%20%20%20%20AvgUsedMemory%2C%0A%20%20%20%20%20%20%20%20%20%20AvgAvailBytes%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor
Follwing query gives values from multiple performance counters but in a different rows. Is it possible to add performance counter's value in columns
 
Perf
| where ObjectName =="Memory" and CounterName=="% Committed Bytes In Use" or CounterName=="% used memory" or CounterName=="Available MBytes"
| summarize Avg_Memory_Usage=avg(CounterValue) by Computer, CounterName
 
required output
Computer, Available Memory, %committed memory
xyz, 3000, 20
2 Replies

May we be we can create a temp table and join the two data sets to have perf counter values in columns instead of row. If someone could help give an example of that may also help

 

@samer87 

@samer87 

 

You can store the results using the Let statement - note, all three lets must return data for this to work - thats why I have commented out two lines as I don't have "% used memory" data in the workspace 

 

Go to Log Analytics and Run Query

 

let commitedBytes = (Perf
| where ObjectName =="Memory" and CounterName=="% Committed Bytes In Use"
| summarize AvgCommitedBytes=avg(CounterValue) by Computer);
let usedMemory = (Perf
| where ObjectName =="Memory" and CounterName=="% used memory"
| summarize AvgUsedMemory=avg(CounterValue) by Computer);
let availableBytes = (Perf
| where ObjectName =="Memory" and CounterName=="Available MBytes"
| summarize AvgAvailBytes=avg(CounterValue) by Computer);
commitedBytes 
//| join kind=inner (usedMemory)     on Computer 
| join kind=inner (availableBytes) on Computer 
| project Computer,
          AvgCommitedBytes,
//          AvgUsedMemory,
          AvgAvailBytes