Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bruno_m_santos
Partner - Creator
Partner - Creator

Is possible to use alternate States with set analysis

Hello,

I'm new with alternate states.

It's possible to use alternate states (ie use Group1) with a set analysis syntax as below? Can you give a sample please?

=Count({$<MonthID = {"<=$(=Max(MonthID))"},
Date = {"<=$(=Max(Date))"},
Year = {$(=Max(Year))},
Quarter = ,
Period = ,
[Period (#)] = ,
Month = >}Operacoes_DetalheKey)


Many Thanks

Bruno

1 Solution

Accepted Solutions
agilos_mla
Partner - Creator III
Partner - Creator III

Hi, Here is a sample of set analysis syntax with alternate states. Use [State Identifier] and ::

Function({[state_identifier1] <field_name2= [state_identifier2]::field_name3>}field_name)

Set values for field_name2 within [state_identifier1] basedon values of field_name3 in [state_identifier2]

e.g. sum({Group1}  <Year=$::Year> Sales)

e.g. avg({MarketDev} <Year={BaseLine}::Year,Category={Global}::ProductCategory>SalesLeadTime


Achieving the same thing with 2 differentsyntax:


Option 1 - sum({[Group 1]<Region =$::Region, [Sales Rep] = $::[Sales Rep], Path = $::Path, Year= $::Year, Quarter = $::Quarter, Month = $::Month>} Sales)


Option 2 - sum({$<[Product Sub Group]= [Group 1]::[Product Sub Group] >} Sales)


Hope that helps,

Michael


View solution in original post

13 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try with this

    

=Count({Group1<MonthID = {"<=$(=Max(MonthID))"},

Date = {"<=$(=Max(Date))"},

Year = {$(=Max(Year))},

Quarter = ,

Period = ,

[Period (#)] = ,

Month = >}Operacoes_DetalheKey)

Celambarasan

agilos_mla
Partner - Creator III
Partner - Creator III

Hi, Here is a sample of set analysis syntax with alternate states. Use [State Identifier] and ::

Function({[state_identifier1] <field_name2= [state_identifier2]::field_name3>}field_name)

Set values for field_name2 within [state_identifier1] basedon values of field_name3 in [state_identifier2]

e.g. sum({Group1}  <Year=$::Year> Sales)

e.g. avg({MarketDev} <Year={BaseLine}::Year,Category={Global}::ProductCategory>SalesLeadTime


Achieving the same thing with 2 differentsyntax:


Option 1 - sum({[Group 1]<Region =$::Region, [Sales Rep] = $::[Sales Rep], Path = $::Path, Year= $::Year, Quarter = $::Quarter, Month = $::Month>} Sales)


Option 2 - sum({$<[Product Sub Group]= [Group 1]::[Product Sub Group] >} Sales)


Hope that helps,

Michael


bruno_m_santos
Partner - Creator
Partner - Creator
Author

Thanks Michael,
Your tip was very helpful.
Can you just clarify for me what would I use the syntax described in option 1.
Bruno

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     $:: is to use the selection in the default state filters.instead of $ you can specify the group name to synchronize with it

     Can you tell me what your trying to achieve?

Celambarasan

bruno_m_santos
Partner - Creator
Partner - Creator
Author

Hi Michael,

I'm just trying to understand the logic, because i'm debugging the reason why I have different results for the alternate state (Group1) of what I have without using the "alternate state" but simulating the same conditions.

I'll update this forum.

Thanks

Bruno

Not applicable

I'm trying to follow some of Michael's examples, but I'm getting errors in the "::" and "$::" syntax.   I've tried playing around with all the examples above but am still not successful. 

I have a measure (Sales), and I've created two Groups (Group1 and Group2), both are there to select/compare date ranges).  I want to be able to select other filters/list boxes and also have them apply to the Bar chart...I've made those other list boxes alternate states, too (for example: variable Partner I called Partner1...variable Channel I've named Channel1, etc.).  I'm trying to figure out how to get those alternate states into the Sales expression.

Any more samples or logic/concepts that can help me?  Thanks!

lorenwood
Contributor III
Contributor III

Thanks this really helped, Loren

Not applicable

Use the syntax with the [ ] brackets

=(SUM(  { State1Name < [Field1]=[State2Name]::Field1>} Sales )

Ran into the same problem with the curly braces { }

Rgds

Not applicable

Hi Michael,

I have tried this but in my sample application, I am not getting how is my thired expression's output is coming (need some explanation on it).

PFA for my sample App. And it will be great if you explain your other options too.

Thanks in Advance!!!

-Yojas