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