skip to Main Content

I have table (data)

SWFLogOSot_CL

and I’m trying to see count of two columns:

values_in_use_connections_d
values_available_connection_d

I’ve done this:

union withsource="SWFLogOSot_CL" *
| summarize AvaibleConn = count() by ColumnName="values_available_connection_d"

This works, but shows count of just one column:

enter image description here

Does please anyone knows, how to add both values_in_use_connections_d and values_available_connection_d?

Thank you

Edit 1:
To add to the information, what I’m trying.
I tried this

union withsource="SWFLogOSot_CL" *
| summarize AvaibleConn = count() by ColumnName="values_available_connection_d", InUseConn = count() by ColumnName="values_in_use_connections_d"

to add another column with new data from the table, but I got a message
Query could not be parsed at ‘=’ on line [3,49] Token: ‘=’ Line: 3 Postion: 49

so unfortunately I still can’t get 2x columns (the number of them) from SWFLogOSot_CL into one table

Edit 2:

with

let availableData = 
    union withsource="SWFLogOSot_CL" *
    | summarize Conn1 = count() by ConnectionType = "Available", ColumnName = "values_available_connection_d";

let inUseData = 
    union withsource="SWFLogOSot_CL" *
    | summarize Conn2 = count() by ConnectionType = "InUse", ColumnName = "values_in_use_connections_d";

im able to get two variables.

But im not sure how to display them

2

Answers


  1. Chosen as BEST ANSWER

    Thank you very much for your reply, I finally came up with this solution:

    let data = SWFLogOSot_CL
    | summarize values_available = sum(values_available_connection_d), values_in_use = sum(values_in_use_connections_d)
    | project values_available, values_in_use;
    
    data
    | project label="Values Available", value=values_available
    | union (data | project label="Values in Use", value=values_in_use)
    | extend total = toscalar(data | summarize sum(values_available + values_in_use))
    | extend percent = value * 100 / total
    

    Thank you very much and sorry for the chaotically written question


  2. do you mean "count of distinct values in 2 columns?"

    using "count" as you’re using it would just return the same number as the number of rows you have.

    if so,

    SWFLogOSot_CL
    | summarize 
        InUseConnections=dcount(values_in_use_connections_d), 
        AvailableConnnections=dcount(values_available_connection_d)
    

    Otherwise, it would be more helpful to see a more complete example, like

    • the table has this structure
    • and pretend it has these N rows
    • and i want to get a grid out that has this structure
    • and has these M rows as results

    (also unclear why the tilte has anything to do with jQuery?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search