Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikwiz123
Creator III
Creator III

Difference/Trend based on Month(s) field - Retention

I have the following Data model with the fields:

Month

Customers

Month          Customers

Jan                200

Feb                150

Mar                170

Apr                 220

.                        .

.                       .    

Dec                  80

I need to provide users option where the users can select any month or months and the difference between the selected month(s) and the remaining months should be populated.

For example, if the user selects Jan, the following output should be seen

Month          Customers           Difference

Jan                200                    0

Feb                150                   50

Mar                170                   30

Apr                 220                  -20

.                        .                     .    

.                       .                      .

Dec                  80                  120

The user should be able to pick any month or months instead of Jan, dynamically and based on the selected month, the Difference column should be calculated.

1 Solution

Accepted Solutions
pradosh_thakur
Master II
Master II

may be this

Capture.PNG

Learning never stops.

View solution in original post

14 Replies
devarasu07
Master II
Master II

Hi,


Try to use above function,

create measure like below

alt(sum(Customers)-Above(Customers),0)


Capture.JPG

pradosh_thakur
Master II
Master II

may be this

Capture.PNG

Learning never stops.
qlikwiz123
Creator III
Creator III
Author

My requirement is a bit different.

The User should be able to pick a month and the difference should be based on the selected month.

For example, if the user selects March, the difference for all the months should be (March ~ Individual Months)

qlikwiz123
Creator III
Creator III
Author

Hi,

Thank you so much. Can we do the same thing for multiple months? In case, if the user selects two or months, for example, Jan and Feb, the result should be (Jan + Feb) ~ each individual remaining months.

pradosh_thakur
Master II
Master II

yes.

month filter has always one selected value . uncheck that and select multiple months , it shall work.

but let me warn you i have used alternate states here. you can do the other way around and use table in alternate state and filter in inherited state.

Learning never stops.
qlikwiz123
Creator III
Creator III
Author

Selecting multiple months is not giving the right numbers in the result column. Any changes needed for the expression?

pradosh_thakur
Master II
Master II

this is what i am getting . feb+jan - months . is the requiremnt diffrent. if so please post the expected output Capture.PNG

Learning never stops.
qlikwiz123
Creator III
Creator III
Author

The state works for once and gives correct values soon after. But when I change the sheet, reload data or close and open the file, the state isn't working.

qlikwiz123
Creator III
Creator III
Author

The Alternate state gives out the result column when created. But later doesn't give the values which are correct. Strange. Any reason why it is behaving this way