Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
kunkumnaveen
Specialist
Specialist

how to write dynamic expression

Hello all , if i have a sample data like ,how to write a dynamics expression

category  decision      material  lot

smelting    accepted      spix      10

smelting      rejected        spix      20

smelting      exception      spix      30

mining          accepted      hydra      25

mining          rejected        hydra    35

mining        exception      hydra      45

so i need a dynamic  expression :   category={smelting},decision={accepted } and that particular material lot     =       10     in percentage

                                                  category={smelting}   total lot                                                                            (10+20+30)

thanks

naveen

11 Replies
Kushal_Chawda

If you want dynamic, based on selection then create two variables on front end

vCategory = concat (distinct chr(39) category chr(39) ,',')

vDecision = concat (distinct chr(39) decision chr(39) ,',')

Now write the expression

Sum({<category = {$(vCategory)}, decision = {$(vDecision)}>} lot) / Sum({<category = {$(vCategory)}>} lot)


or


Sum({<category *= {$(vCategory)}, decision *= {"$(vDecision)"}>} lot) / Sum({<category *= {$(vCategory)}>} lot)


Expression will show error but it will work


Edit: remove " from set

t_chetirbok
Creator III
Creator III

hi!

try this num(sum(lot)/sum(TOTAL{<decision=>} lot),'#,##0%')