Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to have a dimension to be changed on my Line chart depending on a selection in a 'Period' field. For example if 'Today' is selected I want to have hour granularity, if 'This year' is selected I want to have month granularity. I have appropriate fields.
So I am trying to use this expression for my dimension field:
= if(Period = 'Today', Hour,
(if(Period = 'Yesterday', Hour,
(if(Period = 'This week', Weekday,
(if(Period = 'This month', Day,
(if(Period = 'This year', Month, Day)
)
)
)
)
)
)
)
)
But, it doesn't work.
What I am missing or doing wrong?
Thanks for any advises.
I have got a solution to my problem.
We need to create a set of variables with field names assigned:
vHour = CanonicalHour
vDay = CanonicalDay
vMonth = CanonicalMonth
etc.
After we should create a variable with condutional selection:
vDimension = if(GetFieldSelections(Period) = 'This month', vDay,
if(GetFieldSelections(Period) = 'This year', vMonth, vHour // and so on
)
)
And finally we write in our dimension expression:
$(=$(vDimension))
Voila, it works)
@Andrei_Faibich Did you try creating Drill down Dimension?
First you need to create a Drill Down Master Item by Adding all the fields required.
Use the same Drill Down Dimension in the Dimension of line chart and Filter Pane
Please refer below link for additional Details.
If this resolves your issue, please like and accept it as a solution.
Thanks for the prompt reply, but
I need this logic to be hardcoded, user selects only values from the field 'Period'!
I have got a solution to my problem.
We need to create a set of variables with field names assigned:
vHour = CanonicalHour
vDay = CanonicalDay
vMonth = CanonicalMonth
etc.
After we should create a variable with condutional selection:
vDimension = if(GetFieldSelections(Period) = 'This month', vDay,
if(GetFieldSelections(Period) = 'This year', vMonth, vHour // and so on
)
)
And finally we write in our dimension expression:
$(=$(vDimension))
Voila, it works)