Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

How to create a 3 lines chart controlled by 3 date range picker?

HI there, 

i have a user requirement. user would to have 3 date range pickers to control 3 lines in a chart. 

My failure screenshot as such. 

when i choose a date in period1 , it comes out a line, preiod 2 also comes out the same line. there are not 3 lines appeared.

for the issue, i am using simple measurement - sum(sales). 

 

my sample data as pr attached.

 

i cant provide my qvf, due to company policy. please help guys!

jim_chan_0-1652787913009.png

 

Rgds

 

Jim

 

Labels (3)
8 Replies
justISO
Specialist
Specialist

Hi, try to create 3 different Alternate States, for example, 'State1', 'State2', 'State3' and apply these states to each Date pickers. In graph add 3 different measures, so each will correspond to your dates selected in different states:

sum({State1} SALES)

sum({State2} SALES)

sum({State3} SALES)

jim_chan
Specialist
Specialist
Author

Thanks! But in scenario , I have few filters as well, like states , store, region. So, user will select other filters and pick a date range in period 1 , 2 ,and 3.

With alternate state, how is it going to solve this scenario?

justISO
Specialist
Specialist

you can add these filters, like:

sum({State1 <states=$::states, store=$::store, region=$::region>} SALES)

so they will be applied also despite alternate state.

jim_chan
Specialist
Specialist
Author

Will give it a try tomorrow my friend . Any other alternative?? How about using variable ? I don't really know how to Create a variable , and control it.

jim_chan
Specialist
Specialist
Author

Hi there, 

it actually work ,with the alternate state. But,  how to put in the alternate state, in this variable? i have a variable and would like to use for alternate state as well. 

Here it is, how should i put it in  =$(=$(vAdhocExpression_Q(1)))

Rgds

Jim

 

justISO
Specialist
Specialist

I'm not sure is variables can be assigned to an alternate state. Maybe it is easier to create separate variables for each states? Or maybe try something like this:
if ($(vAdhocExpression_Q)=1, sum({State1 <states=$::states, region=$::region>} SALES) )
Or try to search in forum similar problems with variables in alternate states. I don't think you are the first to encounter this problem and nobody found a solution before.

jim_chan
Specialist
Specialist
Author

I have try use the full set analysis like this, but  the alternate state didnt seem to be working, did i put the alternate state at the correct place?

 

(Sum({[State1]<STORE={$(vInputStore)},MATERIAL={$(vInputNumber)},SALES_DAY={"$(vDateRange1)"}>}SALES)
+
Sum({[State1]<STORE={$(vInputStore)},MATERIAL={$(vInputNumber)},SALES_DAY={"$(vDateRange1)"}>}JOBS_AMT))
/$(vDelimeter)

 

Is it correct placing?

 

Rgds

Jim

justISO
Specialist
Specialist

As you can't set alternate state for variables, and as I understood you only choose dates per state, why not try this approach:

(IF(STORE='$(vInputStore)' and MATERIAL='$(vInputNumber)' and SALES_DAY='$(vDateRange1)', Sum({State1}SALES))
+
IF(STORE='$(vInputStore)' and MATERIAL='$(vInputNumber)' and SALES_DAY='$(vDateRange1)', Sum({State1}JOBS_AMT))
) / $(vDelimeter)