Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Alternate States: Default state to variable in Expressions

Hi Team,

I have a small query. Say i have a Volume expression

Alternate State A: I want expression to consider all dimensions of state A but default of Month.

Volume for Current Month:

Month is max month is setting by making a selection in a text box:

Sum(A{<Month=$::Month>}Sales)

For growth calculation i have set variable Vprev in the same text Box  :

Vprev is setting to a Flag: Flag_PrevMonth

so whenever this flag=1, we get volume of sales for previous month

Sum(A{<Vprev={'1'}>}Sales)


I want this Vprev to belong to default state? Like i have pointed Month for current volume, How can i point a variable having this Flag_PrevMonth colume to take default state?


Thanks'

Khushboo

8 Replies
Gysbert_Wassenaar

Perhaps like this: Sum({A}*{$<$(Vprev)={'1'}>}Sales)


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert.

But this * is not working in my version. Version is 11.2

But without using * is working.

Sum({A}{$<$(Vprev)={'1'}>}Sales)---- Is that fine?

actuatll the expression for current i have built is :

Sum({A<Week::$Week,Month::$Month,$(vMarket)>}Sales)--- This is working correctly for current sales

For Previous

Sum({A}{<$(vPrev)={'1'},$(VIgnoreTime),$(vMarket)>}Sales)

Will the above work accurately as per my use case. Where i want only time from default state, rest all on the basis of alternate state?

Thanks

Gysbert_Wassenaar

But this * is not working in my version. Version is 11.2

Then there are no records that match the selections you want from state A and the default state

But without using * is working.

That's because it will ignore {A} completely.

Please post a small qlikview document with example data that explains what you want.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysberth,

I have tried to replicate the same scenario in sample app, I have a button TIME: Current Month

When i select that i want Current Volume and Previous Volume.

I have location in state A. I want Current Volume to be affected by all State A selections and default time period selections which i have achieved.

But Same thing i want for Previous Month volume as well?

How to achieve that?

sunny_talwar

May be this?

Sum({A<MONTH1={"$(=Date(AddMonths(Max({$} MONTH1), -1), 'YYYYMM'))"}>}[PROJECTED TRX])

Not applicable
Author

I have very complex expressions in actual dashboard. And many time period. I want to use variables vPrev only which is getting set by the button.

sunny_talwar

Right now your vPrev is only associated with only one MONTH1, which is 201502.... So no matter what your selection might be, you will always see just one single number. it seems that your data model in the sample is not correct, may be fix your data model in the sample or share you original app

Preparing examples for Upload - Reduction and Data Scrambling

Not applicable
Author

Hi Sunny,

Data model is accurate only.

However i found the solution to my query.

sum({A<$(vPrev)={'1'}>}Sales)

This is giving me accurate results.  For previous month sales is cuming. and rest all dimension which are in group A are only getting affected.

Thanks

Khushboo