Dashboards & Visualizations

How to hide the panel in a dashboard based on drop down filter?

patra966
Path Finder

Let's assume 1st drop down values are 1.workplace , 2. Sales , 3. Marketing and 4 . Production.
2nd drop down values depend upon the locations.
Case -1 :If I select
India - show only Sales & Marketing
USA - show only Production
Argentina - show only workplace

Case 2: Same way I have 4 panel with some query.
If I select workplace, it should show Workplace panel with hiding all other panel.

Case3: Location as India and 2nd drop down as a sales . It should only Sales panel.

How can I get this, please help me out.

Thanks in Advance.

Labels (1)
Tags (2)
0 Karma

Taruchit
Contributor

Hello All, 

I need your help to hide and display a panel on the dashboard based on end user's selection of using a dropdown or radio button. 

Please help by sharing your approach. 

Thank you

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Have each panel that you want to hide or show have a depends attribute specifying a unique token.

In the change handler for your selection dropdown, set the corresponding token based on whether the value has been selected.

Depending on how you want the hiding to work, you could either unset all the other tokens, or have a dropdown value "Hide all" for example, which you unset all the panel tokens

0 Karma

Taruchit
Contributor

Thank you for your response. I was able to build the functionality successfully. I have added the code for reference: -

<row>
<panel>
<input type="checkbox" token="xxxToken">
<label>Show xxx details</label>
<choice value="1">Show</choice>
<initialValue>1</initialValue>
</input>
</panel>
</row>
<row>
<panel depends="$xxxToken$">
<table>
...
</table>
</panel>
</row>


Please share if you have any suggestions to improve the same.

Thank you

0 Karma

DalJeanis
Legend

There are many ways to accomplish this, and the best will depend on what effect your are trying to achieve.

The general answer is - put either a "depends" or a "rejects" on each panel, and set or unset the desired tokens based on the selection in each dropdown.

This is a run-anywhere screen that will show you how to do this process.

<form>
  <label>Admin dropdown test</label>

        <search id="basechoices">
          <query>
      | makeresults
      | eval mydata="India|Sales!!!!India|Marketing!!!!Argentina|Workplace!!!!USA|Production"
      | table mydata
      | makemv delim="!!!!" mydata
      | mvexpand mydata
      | makemv delim="|" mydata
      | eval location=mvindex(mydata,0)
      | eval TheChoice=mvindex(mydata,1)
      | table location TheChoice
          </query>
          <earliest>-5m</earliest>
          <latest>now</latest>
        </search>

 <fieldset submitButton="false">

    <input type="dropdown" token="tok_location">
      <label>location</label>
      <choice value="Argentina">Argentina</choice>
      <choice value="India">India</choice>
      <choice value="USA">USA</choice>
      <change>
        <unset token="form.tok_department"></unset>
        <unset token="showSales"></unset>
        <unset token="showMarketing"></unset>
        <unset token="showProduction"></unset>
        <unset token="showWorkplace"></unset>
      </change>
       <selectFirstChoice>false</selectFirstChoice>
    </input>

    <input type="dropdown" token="tok_department">
      <label>department</label>
      <search base="basechoices">
        <query>
        | where location= "$tok_location$"
        | fields - location </query>
      </search>
      <fieldForLabel>TheChoice</fieldForLabel>
      <fieldForValue>TheChoice</fieldForValue>
      <selectFirstChoice>true</selectFirstChoice>
      <change>
        <condition match="$value$= &quot;Sales&quot; ">
        <set token="showSales"></set>
        <unset token="showMarketing"></unset>
        <unset token="showProduction"></unset>
        <unset token="showWorkplace"></unset>
        </condition>
        <condition match="$value$= &quot;Marketing&quot; ">
        <unset token="showSales"></unset>
        <set token="showMarketing"></set>
        <unset token="showProduction"></unset>
        <unset token="showWorkplace"></unset>
        </condition>
        <condition match="$value$= &quot;Production&quot; ">
        <unset token="showSales"></unset>
        <unset token="showMarketing"></unset>
        <set token="showProduction"></set>
        <unset token="showWorkplace"></unset>
        </condition>
        <condition match="$value$= &quot;Workplace&quot; ">
        <unset token="showSales"></unset>
        <unset token="showMarketing"></unset>
        <unset token="showProduction"></unset>
        <set token="showWorkplace"></set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends="$showProduction$">
      <html>
        <p> PRODUCTION PANEL</p>
         </html>
    </panel>
    <panel depends="$showMarketing$">
      <html>
        <p> MARKETING PANEL</p>
         </html>
    </panel>
    <panel depends="$showWorkplace$">
      <html>
        <p> WORKPLACE PANEL</p>
         </html>
    </panel>
    <panel depends="$showSales$">
      <html>
        <p> SALES PANEL</p>
         </html>
    </panel>
  </row>
</form> 
0 Karma

to4kawa
Ultra Champion
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...