Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
AshleyD
Contributor
Contributor

KPI under conditions

Hi, I am new to Qlik Sense and I want to make a dashboard of products that have a margin that's equal to or above 40%. 

I have a simple KPI that counts all the products but I want it to only count the products that have a margin equal to or above 40%... I have been trying multiple times and days with all kinds of formula's but they won't work. Can someone help me out? Thanks in advance!

3 Replies
rubenmarin

Hi, You can try with:

count(Distinct {<[ProductIdField]={"=Margin%Expression>0.4"}>} [ProductIdField])

Change Margin%Expression with expression to calculate the margin%

AshleyD
Contributor
Contributor
Author

Hi,

Thanks for your reply. Unfortunately it still does not work 😞

rubenmarin

Hi, with this data:

LOAD * Inline [
ProductId, Sales, Cost
1,105,40
2,65,40
];

If the expression to calculate margin is (Sum(Sales)-Sum(Cost))/Sum(Cost)

This expession works: count(Distinct {<[ProductId]={"=(Sum(Sales)-Sum(Cost))/Sum(Cost)>0.4"}>} [ProductId])

If doesn't works for you, you need to provide more info of what you have, what are you trying and what exactly doesn't works, better if you can upload a sample app to make tests.