Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
eddywong71
Creator
Creator

How can I click the Month Filter not only show single month data?

Hi All,

I have a Dimension Product Category(Apple, Orange).

Then I create a new variable like below;

set VSelect_Product= =Only(Select_Product);

Select_Product:
Load * Inline [
Select_Product
Apple 

Orange

]
;

I want to user click the Select_Product filter box to show Apple or Orange  or Apple and Orange in the same time 

For Apple expression.

if ( WildMatch(concat(distinct Select_Product,', ') ,'*Apple*'),

Sum({$< [Product Category] ={'Apple'}
,Month ={">=$(=AddMonths(max([Month]),-$(vperiod)))<=$(=max([Month]) )"}
>} OPI)

)

For Orange expression.

if ( WildMatch(concat(distinct Select_Product,', ') ,'*Orange*'),

Sum({$< [Product Category] ={'Orange'}
,Month ={">=$(=AddMonths(max([Month]),-$(vperiod)))<=$(=max([Month]) )"}
>} OPI)

)

Both expression work fine if i dont select Month. However, if i select Month it only show the selected Month.

But if i revise the expression :

Sum({$< [Product Category] ={'Orange'}
,Month ={">=$(=AddMonths(max([Month]),-$(vperiod)))<=$(=max([Month]) )"}
>} OPI)

It can also show different month.

How can I revise the expression to match my purpose.

Labels (2)
1 Solution

Accepted Solutions
vincent_ardiet_
Specialist
Specialist

I don't know if this will solved your issue, however, you should be able to remove the IF changing your expression like this:

Apple expression.

Sum({$< [Product Category] *={'Apple'}
,Month ={">=$(=AddMonths(max([Month]),-$(vperiod)))<=$(=max([Month]) )"}
>} OPI)

Orange expression.

Sum({$< [Product Category] *={'Orange'}
,Month ={">=$(=AddMonths(max([Month]),-$(vperiod)))<=$(=max([Month]) )"}
>} OPI)

View solution in original post

2 Replies
vincent_ardiet_
Specialist
Specialist

I don't know if this will solved your issue, however, you should be able to remove the IF changing your expression like this:

Apple expression.

Sum({$< [Product Category] *={'Apple'}
,Month ={">=$(=AddMonths(max([Month]),-$(vperiod)))<=$(=max([Month]) )"}
>} OPI)

Orange expression.

Sum({$< [Product Category] *={'Orange'}
,Month ={">=$(=AddMonths(max([Month]),-$(vperiod)))<=$(=max([Month]) )"}
>} OPI)

eddywong71
Creator
Creator
Author

Thanks for your help