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

Set Analysis Inside Variable with Parameter

Hi!

I have a variable vTest.

sum(
{
$<
Week={0},
Store={"*"}, //all stores
Item={$1}
>
}
total Sales
)

 

That works if I call like this:

$(vTest( "10-8 | ITEM X" ))

 

But does not work if I call like:

$(vTest( Item )) //where Item is the dimension and has the same value as "10-8 | ITEM X"

 

Tried a lot of combinations inside and outside the variable.

Outside:

$(vTest( $(=$(Chr(34) & Item& chr(34))) ))

$(vTest( "=$(Item)" ))

Inside:

sum(
{
$<
Week={0},
Store={"*"},
Item={$(='$1')} // and a lot of different combinations here
>
}
total Sales
)

 

Thank you!

 

Bruno

2 Solutions

Accepted Solutions
chriscammers
Partner - Specialist
Partner - Specialist

I lied, you don't have to use AGGR for that one.

add a measure with Item and Store as dimensions then

Sum(Sales) as the first measure

Sum(Total <Item> Sales) as  the second Measure

Annotation 2019-07-26 145123.png

 

View solution in original post

brunolovatti
Contributor II
Contributor II
Author

It worked! 

Much simpler!

Sum(
{
$<
Week={ 0 }
>
}
total <Item> Sales
)

Thank you!!!

View solution in original post

4 Replies
chriscammers
Partner - Specialist
Partner - Specialist

It looks like you are trying to produce an expression that iterates over your Items and returns one row per item. The problem is that Set Analysis is interpreted only one time per object so the idea of putting a raw unaggregated field into a set analysis expression just does not work. please describe what you are trying to accomplish and we can help.

brunolovatti
Contributor II
Contributor II
Author

I have this data

Store / Item / Sales / TOTAL

1 / A / 100

1 / B / 200

1 / C / 700

2 / A / 400

2 / B /600

I want to show total sales of the same items in all stores. 

1 / A / 100 / 500 

1 / B / 200 / 800

1 / C / 700 / 700

2 / A / 400 / 500

2 / B /600 / 800

 

Thank you!

chriscammers
Partner - Specialist
Partner - Specialist

I lied, you don't have to use AGGR for that one.

add a measure with Item and Store as dimensions then

Sum(Sales) as the first measure

Sum(Total <Item> Sales) as  the second Measure

Annotation 2019-07-26 145123.png

 

brunolovatti
Contributor II
Contributor II
Author

It worked! 

Much simpler!

Sum(
{
$<
Week={ 0 }
>
}
total <Item> Sales
)

Thank you!!!