Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for
Did you mean:
Partner - Creator

## Parameters in Variable with Set Analysis

Hi everyone,

I have a Pivot Table in which I show 7 days in the horizontal dimension. If is there any date selected, the first day will be this one selected, and the others will be the 6 following days. In case of no date selected, the first day of the dimension will be today(), and the others will be the 6 future days.

So, in order to sum what I need in each of these days of my calculated dimension, I'll thought about using a variable with parameters.

My Date dimension is a variable (vDinamic_Dimension) as following:

```ValueList(
dual('\$(=capitalize(weekday((today()-(vDay_Offset))))) - \$(=date(today()-(vDay_Offset)))',1),
dual('\$(=capitalize(weekday((today()+1-(vDay_Offset))))) - \$(=date(today()+1-(vDay_Offset)))',2),
dual('\$(=capitalize(weekday((today()+2-(vDay_Offset))))) - \$(=date(today()+2-(vDay_Offset)))',3),
dual('\$(=capitalize(weekday((today()+3-(vDay_Offset))))) - \$(=date(today()+3-(vDay_Offset)))',4),
dual('\$(=capitalize(weekday((today()+4-(vDay_Offset))))) - \$(=date(today()+4-(vDay_Offset)))',5),
dual('\$(=capitalize(weekday((today()+5-(vDay_Offset))))) - \$(=date(today()+5-(vDay_Offset)))',6),
dual('\$(=capitalize(weekday((today()+6-(vDay_Offset))))) - \$(=date(today()+6-(vDay_Offset)))',7),
dual('\$(=capitalize(weekday((today()+7-(vDay_Offset))))) - \$(=date(today()+7-(vDay_Offset)))',8),
)
```

And my expression is:

```=
if( \$(vDinamic_Dimension)=1,
\$(vOrder_Quantity(((vDay_Offset)+0))),
if( \$(vDinamic_Dimension)=2,
\$(vOrder_Quantity(((vDay_Offset)+1))),
if( \$(vDinamic_Dimension)=3,
\$(vOrder_Quantity(((vDay_Offset)+2))),
if( \$(vDinamic_Dimension)=4,
\$(vOrder_Quantity(((vDay_Offset)+3))),
if( \$(vDinamic_Dimension)=5,
\$(vOrder_Quantity(((vDay_Offset)+4))),
if( \$(vDinamic_Dimension)=6,
\$(vOrder_Quantity(((vDay_Offset)+5))),
if( \$(vDinamic_Dimension)=7,
\$(vOrder_Quantity(((vDay_Offset)+6))),
\$(vOrder_Quantity(((vDay_Offset)+8)))
)))))))
```

Here is my question:

I want to know what do I need to use inside de variable vOrder_Quantity, in order to sum the days for each value of the vDinamic_Dimension. I thought about something like this, but it's not working and returns null values.

```vOrder_Quantity =
sum({\$<Day = {'\$(=today()+\$1)'}>} [Order Quantity])
```

Here is my variable for Day Offset:

```vDay_Offset =
num(YearEnd(if(count(GetFieldSelections(Date)) = 0, today(), Date)) - YearStart(if(count(GetFieldSelections(Date)) = 0, today(), Date)),'#.##0')*(year(today()-1) - max(Year))  // Offset Year
+
day(MonthEnd(if(count(GetFieldSelections(Date)>0, Date, today())))*(month(today()-1) - if(count(GetFieldSelections(Date))=0,month(today()-1),max(Month)))   // Offset Month
+
day(today()-1) - if(count(GetFieldSelections(Date))=0,day(today()-1),max(Day))    //Offset day
```

Thanks!

1 Solution

Accepted Solutions
Partner - Creator
Author

Problem solved, using the variable vOrder_Quantity as following:

```vOrder_Quantity = sum({<[Check pedido] = {'Válido'}, Dia = {'\$(=day(today()+ \$1))'}>} [Qt Pedida])
```
3 Replies
Creator III

Partner - Creator
Author

Problem solved, using the variable vOrder_Quantity as following:

```vOrder_Quantity = sum({<[Check pedido] = {'Válido'}, Dia = {'\$(=day(today()+ \$1))'}>} [Qt Pedida])
```
Partner - Creator
Author

Sorry, I can't. There is no need for that, but thanks!

Community Browser