Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need a 2 way filter with functionality similar to a radio button with 2 options
a) Current Year
b) Last 12 months
It should work in such a away that if i select a)current year , only the data corresponding to current year (from january to current month) need to be shown.
But if select b) Last 12 months, the data corresponding to last 12 months ie (2016 June to 2017 July) is to be shown.
Please help me in implementing this.
Thanks in adavance
Hi,
Depending on where you want to use this, you can decide the logic.
If in Bckend (In Script)
Create 2 fields in your master cal i.e to find the current year and last 12 months.
If in FrontEnd.
Use the start and end variable to manipulate as per the selection and use those variable in set analysis to filter data.
Regards,
Kaushik Solanki
Create 2 buttons
1 for Current Year and 2nd for last 12 months
create Variable which store button action say vYearToDisplay
set below property on Button Current Year
Button > Property> Action > External > Variable Name : vYearToDisplay
Value="currentYear"
similar for Button Last 12 Year
set below property
Button > Property> Action > External > Variable Name : vYearToDisplay
Value="last12Year"
Then In char write expression
if(vYearToDisplay="currentYear",YourCurrentYear Expression,Last 12 Expression)
Regards,
Prashant
Can you pls explain the first option in detail? i am very new to this.
Is it like seprate columns which could give 2 flag values for the months ?
Month Current year Last 12 months
june 2016 0 1
july 2016 0 1
aug 2016 0 1
.
.
dec 2016 0 1
jan 2017 1 1
frb 2017 1 1
.
july 2017 1 1
Try this.
Let vMin = num(MakeDate(2016));
Let vMax = Floor(MonthEnd(Today()));
Temp:
Load Date($(vMin) + RowNo() -1) as Date
AutoGenerate 1
While Date($(vMin) + RowNo() -1) < Date($(vMax));
Data:
Load Distinct MonthEnd(Date) as MonthEndDate,
Ceil(Rand()*1000) as Sales
Resident Temp;
MasterCal:
Load Distinct MonthEnd(Date) as MonthEndDate,
'Current Year' as FLag
Resident Temp where Date >= YearStart(Today());
Load Distinct MonthEnd(Date) as MonthEndDate,
'Last 12 Months' as FLag
Resident Temp where Date >= Addmonths(MonthEnd(Today()),-12);
Drop table Temp;
Regards,
Kaushik Solanki
i tried using this button.Qlik Branch
But i cannot use the variable i set in the button properties in the expression.
i used a kpi with following expresion to display a value to test it
if (Checkbox_Var1=true ,1,0)
but it's not working.. can u pls help on this?