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

Filtering measures created with alternate states

Hello, I have what I hope to be a simple problem:

I created two alternate states:
Period1
Period2

I then added the same period dimension to my sheet twice as filter panels and applied the alternate state to each. 

I created the following variance measure:
Sum({Period1}[Sales Amount USD]) - Sum({Period2}[Sales Amount USD])

This works perfectly and shows me the total sales amount variance between whatever period(s) that I select from the filter panels. This gives flexibility to do several different time period variances without creating multiple set-analysis expressions.

However, now I have the simple request to filter the data. For example, say I want to filter by a country (i.e. US or Canada). How can I filter these measures further? 

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Assuming you are making the other selections, like Country, in the default state, just include the default state with the intersection operator:

Sum({Period1 * $}[Sales Amount USD]) - Sum({Period2 * $}[Sales Amount USD])

If you want to make sure your period selections only come from the alternate states, add set modifiers as shown here:

https://qlikviewcookbook.com/2016/07/alt-states-merged-selections-tip/

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Assuming you are making the other selections, like Country, in the default state, just include the default state with the intersection operator:

Sum({Period1 * $}[Sales Amount USD]) - Sum({Period2 * $}[Sales Amount USD])

If you want to make sure your period selections only come from the alternate states, add set modifiers as shown here:

https://qlikviewcookbook.com/2016/07/alt-states-merged-selections-tip/

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

Brysonds
Contributor III
Contributor III
Author

This worked perfectly and thank you for information on the set modifiers!! 🙂