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 (1)
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!

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...

Secure Your Future: Mastering Upgrade Readiness for Splunk 10

Spotlight: The Splunk Health Assistant Add-On  The Splunk Health Assistant Add-On is your ultimate companion ...

Observability Unlocked: Kubernetes & Cloud Monitoring with Splunk IM

Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team on ...