Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
stephenedberkg
Creator II
Creator II

set analysis in bar chart

i want to show sales >= target

i have some of product each product have the sales and target.my dimension is product

i want to show in bar chart which product sales values is greater or equal to the target values.

i dont want to show the sales values which are below the target values

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

Dimension: Product

Exp: Sum({<Product={"=Sum(Sales)>=Sum(Target)"}>}Sales)

View solution in original post

6 Replies
tresesco
MVP
MVP

Try like:

Dimension: Product

Exp: Sum({<Product={"=Sum(Sales)>=Sum(Target)"}>}Sales)

maleksafa
Specialist
Specialist

if(sum(sales) >= sum(target),sum(sales))

this will only show the sales by product that are greater than the target

Anonymous
Not applicable

I guess you can use Calculated Dimension like:

if((aggr(sum(sales), Product)>=(aggr(sum(Targets), Product), ProductDimension) as Product_Dimension

and expression as per your requirement.

Else you can create a flag at Script/Backend if all the fields are in one table.

Hope this will help!!

tamilarasu
Champion
Champion

Hi Tresesco,


Just a question. Each product have some target, so why you used sum(Target) in the expression.!!


It should be like Sum({<Product={"=Sum(Sales)>=Target"}>}Sales). Right?


Correct me If I am wrong.

tresesco
MVP
MVP

There could be multiple sub lines to that. What if I wish to have aggregated result irrespective of say a dimension Region? Otherwise, logically you are not wrong. But it's safer to use an aggregation function, after all that doesn't harm you here.

tamilarasu
Champion
Champion

Thanks for the explanation.