How to set separated columns in workbook

Kessler, Oded 20 Reputation points
2023-12-28T06:48:20.45+00:00

Hello all ,

i have been using workbooks for soe time .

i have a query that return number of failed and success iteration per action ,

i want to see in the results 2 columns per type , but i cant manage to make it work .

my query is:

traces
| where * has "workflowid"
| where timestamp {TimeRange}
| extend ActivityType = tostring(customDimensions.ActivityType) 
| extend message = tostring(message)
| where (message has "Status: Failed" or message has "Status: Successful") and message has "ActionType: WORKFLOW"
| extend FailedCount = case(message has "Status: Failed", 1, 0)
| extend SuccessfulCount = case(message has "Status: Successful", 1, 0)
| extend WorkflowType = tostring(customDimensions.WorkflowType)
| extend WorkflowId = tostring(customDimensions.WorkflowId)
| summarize FailedCount = sum(FailedCount), SuccessfulCount = sum(SuccessfulCount) by WorkflowType
| sort by WorkflowType
| render columnchart
    with(
    title="Workflow Distribution Results - Per WorkFlow Type",
    xtitle= "WorkFlow Type",
    ytitle= "Total")


this the table i have 1 column separated to 2 categories .

User's image

these are the query setting in the workbook (visualization : Bar chart Categorical)

User's image

User's image

When i change visualization to Unstacked this is the result i get :

User's image

when i try to run the query in log analytics :

// Workflow Distribution Results - Per WorkFlow Type //
let activityType  = "WORKFLOW";
let activitySuccessfulStatus = "Successful";
let activityFailedStatus = "Failed";
let workflowId = "workflowid";
let titleName = "Workflow Distribution Results - Per WorkFlow Type";
let xtitle = "Workflow Type";
let ytitle = "Total";
union isfuzzy=true
    traces
| where * has workflowId
| extend ActionType = tostring(customDimensions.ActionType)
| extend ActivityType = tostring(customDimensions.ActivityType) 
| extend TemporalStatus = tostring(customDimensions.TemporalStatus)
| extend message = tostring(message)      
| where ActionType == activityType and (TemporalStatus == activitySuccessfulStatus or TemporalStatus == activityFailedStatus)
| extend FailedCount = toint(TemporalStatus == activityFailedStatus)
| extend SuccessfulCount = toint(TemporalStatus == activitySuccessfulStatus)
| extend WorkflowType = tostring(customDimensions.WorkflowType)
| extend WorkflowId = tostring(customDimensions.WorkflowId)
| project WorkflowType, FailedCount, SuccessfulCount
| project-rename Failed = FailedCount
| project-rename Successful = SuccessfulCount
| sort by WorkflowType
| render columnchart kind=unstacked with(title = titleName, xtitle = xtitle, ytitle = ytitle)


// Workflow Distribution Results - Per WorkFlow Type //
let activityType  = "WORKFLOW";
let activitySuccessfulStatus = "Successful";
let activityFailedStatus = "Failed";
let workflowId = "workflowid";
let titleName = "Workflow Distribution Results - Per WorkFlow Type";
let xtitle = "Workflow Type";
let ytitle = "Total";
union isfuzzy=true
    traces
| where * has workflowId
| extend ActionType = tostring(customDimensions.ActionType)
| extend ActivityType = tostring(customDimensions.ActivityType) 
| extend TemporalStatus = tostring(customDimensions.TemporalStatus)
| extend message = tostring(message)      
| where ActionType == activityType and (TemporalStatus == activitySuccessfulStatus or TemporalStatus == activityFailedStatus)
| extend FailedCount = toint(TemporalStatus == activityFailedStatus)
| extend SuccessfulCount = toint(TemporalStatus == activitySuccessfulStatus)
| extend WorkflowType = tostring(customDimensions.WorkflowType)
| extend WorkflowId = tostring(customDimensions.WorkflowId)
| project WorkflowType, FailedCount, SuccessfulCount
| project-rename Failed = FailedCount
| project-rename Successful = SuccessfulCount
| sort by WorkflowType
| render columnchart kind=unstacked with(title = titleName, xtitle = xtitle, ytitle = ytitle


i need to change the char formatting manually to : unstacked column then i see this result :

User's image

you can see that in my query i have set :

render columnchart kind=unstacked
render columnchart kind=unstackedrender columnchart kind=unstacked 
render columnchart kind=unstacked 

i hope you can help me out ...

thank you

Oded Kessler

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,326 Reputation points Microsoft Employee Moderator
    2023-12-28T22:35:32.48+00:00

    Hi @Kessler, Oded

    There isn't anything explicitly stating it, but unstacked bar charts aren't available in Workbooks. I would use Azure Monitor workbook chart visualizations - Azure Monitor | Microsoft Learn doc as it lists what chart visualizations are currently available. If the cart isn't listed here, then it's like unavailable or not supported.


    EDIT 4 Jan 2024 You can in fact use a stacked bar chart with the workbook. What you have to do is explicit pick the visualization in the workbook and save to persist. The visualization isn't inferred from the settings passed to the render option.

    User's image


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.