Filters as Sidebars

Hello guys,

Please i need help with a dashboard logic. I have four filters as multiselect sidebars to filter or affect the visualization.
However, when i select any of the conditions, irrespective of the choice it works fine, but when more than one filter is used concurrently, it doesn’t display correctly. For example, if i select card in the method filter, and sale in the purpose filter, it displays data either inclusive of my selection or otherwise, basically not displaying the right information.
Please what is a work around? This has been a challenge.

pay_workspace = pd.merge(left = payments, right = workspaces,left_on =‘workspaceId’,right_on =‘_id’, validate=“m:1”)
pay_work_cat = pay_workspace.merge(right = categories, left_on = “category”,right_on = “_id”,validate=“m:1”,how = ‘left’)
pay_work_cat.rename(columns={“_id_x”:“payments_id”,“name_x”:“workspaceName”,“createdAt_x”:“paymentDate”,“_id_y”:“c_workspaceId”,“name_y”:“sector”,“createdAt_y”:“workspaceDate”,“_id”:“w_categoryId”},inplace=True)

pay_meth = st.sidebar.multiselect(“Select Payment Method”,pay_work_cat[“method”].unique(),default=pay_work_cat[“method”].unique().tolist())
pay_duty = st.sidebar.multiselect(“Select StampDuty Boolean”,pay_work_cat[“stampDutyPaid”].unique(),default=pay_work_cat[“stampDutyPaid”].unique().tolist())
pay_stat = st.sidebar.multiselect(“Select Payment Status”,pay_work_cat[“status”].unique(),default=pay_work_cat[“status”].unique().tolist())
pay_setlm = st.sidebar.multiselect(“Select Settlement-Status”,pay_work_cat[“settlementStatus”].unique(),default=pay_work_cat[“settlementStatus”].unique().tolist())
#pay_bus = st.sidebar.multiselect(“Select Business”,pay_work_cat[“workspaceName”].unique(),default=pay_work_cat[“workspaceName”].unique().tolist())

total_txnn = pay_work_cat[(pay_work_cat[‘isParent’]==True)|((pay_work_cat[‘isParent’]==False)&(pay_work_cat[‘method’]==‘cash’))]
total_txnz = total_txnn[(total_txnn[‘method’].isin(pay_meth))|(total_txnn[‘status’].isin(pay_stat))|(total_txnn[‘settlementStatus’].isin(pay_setlm))|(total_txnn[‘stampDutyPaid’].isin(pay_duty))]
#total_txn = total_txnn[total_txnn[‘workspaceName’].isin(pay_bus)]

if pay_meth==True:
total_txn = total_txnn[(total_txnn[‘method’].isin(pay_meth))]
if pay_stat==True:
total_txn = total_txnn[(total_txnn[‘status’].isin(pay_stat))]
if pay_meth==[‘card’,‘bank_transfer’] and pay_stat==‘successful’:
#total_txn = total_txnz[(total_txnz[‘method’].isin(pay_meth))&(total_txnz[‘status’].isin(pay_stat))]
total_txn = total_txnn[(total_txnn[‘method’].isin[‘card’,‘bank_transfer’])&(total_txnn[‘status’]==‘successful’)]
else:
total_txn = total_txnz

I too have the same challenge. I’m trying to run a st.sidebar.multiselect() function through my pd.merge().

Interested to hear what you come up with! - sorry i couldn’t be of any help >.<

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.