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

Expression conditional

Hello,

I have the expression sum(sales).

i want to add the following formula if(variable=1,sum(sales)), however with this formula it only applies for the month that variable =1. i would like the expression to calculate the sales for all months if for one month the variable =1.

Thank you

1 Solution

Accepted Solutions
sunny_talwar

Like this?

Capture.PNG

Expression:

If(Max(TOTAL Registration) = 1, Sum({<Date, CLIENT = p(CLIENT)>}Sales), Sum(Sales))

View solution in original post

24 Replies
sunny_talwar

Is variable a field here? or is it truly a variable? How does it get different values for different months if it is truly a variable?

prat1507
Specialist
Specialist

Hi Pablo


This might work


= if(variable=1,sum({1}sales)),


Regards

Pratyush

Anonymous
Not applicable
Author

Hello,

@Sunny You are right is a dimension. The dimension gets the valor 1 showing when it started getting sales.

@Pratyush with your expression it gives me the sales when the dimension is one, but no for the following months.

thank you

sunny_talwar

May be this:

If(Max(TOTAL <Month> variable) = 1, Sum(sales))

or if month is the only dimension you have in the chart, then this:

If(Max(TOTAL variable) = 1, Sum(Sales))

Anonymous
Not applicable
Author

with both expressions, still the same result i had.

sunny_talwar

Would you be able to share a sample or show screenshots of what you have?

Anonymous
Not applicable
Author

Sure, here you have a sample of my data.

vinieme12
Champion III
Champion III

please post your variable expression

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

Not 100% sure, but are you looking for something like attached?