Change to alternative dimension when Time dimension changes
In my application I have some line charts with the primary dimension as Week and the alternative dimension as Date. When a user filters their view by Period or Year, (but not Week or Date), I'd like the chart's primary dimension to be Week. When the user filters down to the Week level, I'd like to change the chart's primary dimension to Date.
I donot know if understand well what you say so... If you need your line charts have Week dimension when there are many weeks available in resulting selections and Date when is only a week available you could try the following calculated dimension: If(Count(DISTINCT Week) = 1, Date, Week)
The suggested use of a variable seems to be on the right track. The expression no longer gives an "invalid dimension" message. However, it doesn't work as expected; if I filter on one week it should show me Dates, but it still only shows the week.