Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have two kinds of measurements. One measurement is used for static information. This measure shows last observed year if the user does not select year - typically in a kpi (see measurement 1). The other measurement is used to show information through years - typically in a line chart (see measurement 2). The measurements are like this:
1)
if(GetSelectedCount(Year)=0,
Sum({<Year={$(=MAX({$<Sales -= {'=(NULL())'} >}Year))}>}Sales),
Sum(Sales))
2)
Sum(Sales)
As they are constructed I cannot use measurement 1 in a line graph for example. I would like to combine measurement 1 and 2 into a single measurement so that they will display information regardless of chart type. The main reason - it will not be easy to maintain when I have several 'dualistic' measurements of the same kind.
Why can't you use this in a line chart? I think you should be able to use this... unless I am missing something?
If(GetSelectedCount(Year) = 0,
Sum({<Year = {$(=Max({$<Sales = {"*"}>} Year))}>} Sales),
Sum(Sales))
I have prepared an example. In the first line graph I use measurement 2) for both lines. In the second graph I have substituted the red line with measurement 1). As you see the result is a dot (giving the result for MAX year). It will be like this (GetSelectedCount(Year) = 0) unless I actively chooses several years from the filter pane.
So, what exactly do you wish to see happen in your second chart?
When a user has not selected any years, I wish the second chart to display exactly like the first chart.
And what will you see when something is selected by the user?
When the user has selected one or several years, I want the line chart to display the years accordingly.
Then why can't you just use Sum(Sales)? That seems to be exactly what you are looking for... what do you need measurement for?
I CAN use Sum(Sales), but the problem is to maintain double sets of expressions. I have the same duplicate issue for several measures. That is duplicates of names (with slightly differences), expressions (with slightly differences), label expressions (with slightly differences 🙂 and descriptions (which will be the same, but needs to be updated two places when necessary). I hoped there could be a more rational possible solution.