Dashboards & Visualizations

How to group stacked bar chart by a value?

KalebeRS
Explorer

Hello,

 

I have the following code for a bar chart that I need to show stacked the results from the 3 ifs that I have. The code retrieves data by week number and divides then by each day of the week.

Is it possible to group the data by week number showing each result for the day of the week stacked by the results of the 3 if's that I have?

index="" host= sourcetype=csv [search index="" host= sourcetype=csv source=C:\\2023-CW28_2.csv | dedup source | table source | sort - source | head 1 ] 
| table iswID, iswTitle, iswSD, pverID, pverSF
| where iswSD >= strftime(relative_time(now(), "-3w@w"),"%Y-%m-%d")
| eval Week=strftime(strptime(iswSD,"%Y-%m-%d"),"%V")
| eval Day=strftime(strptime(iswSD,"%Y-%m-%d"),"%A")
| eval ISWGT=if(iswSD>pverSF,1,0)
| eval ISWLE=if(iswSD<=pverSF,1,0)
| eval non_mapped= if(match(pverID,""), 1,0)
| chart sum(ISWGT) as "iswSD gt pverSF", sum(ISWLE) as "iswSD LE pverSF", sum(non_mapped) as "Non Mapped" by Week,Day

 

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The simple answer is no.

A bar chart has three things, an x-axis, a y-axis, and a set of series of data. For a stacked chart, each series is stacked according to its x-axis label and its y-axis value.

You appear to have four things, week, day, "if" name, and "if" sum.

0 Karma
Get Updates on the Splunk Community!

Database Performance Sidebar Panel Now on APM Database Query Performance & Service ...

We’ve streamlined the troubleshooting experience for database-related service issues by adding a database ...

IM Landing Page Filter - Now Available

We’ve added the capability for you to filter across the summary details on the main Infrastructure Monitoring ...

Dynamic Links from Alerts to IM Navigators - New in Observability Cloud

Splunk continues to improve the troubleshooting experience in Observability Cloud with this latest enhancement ...