Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to create a bar chart that shows a current month/previous month value fr each month. right now I have in my dimensions month and the expense type. I have already created an expression that will limit my expense type to the correct value, sum({<EXPENSE_TYPE = {'EBITDA'}>} AMOUNT). what I am trying to do now is show, for each month, the calculated values of that month divided by the previous month, do I need to use month(today()-1)/month(today()-1,-1) as part as part of the expression, and if so, how do I write the rest of it?
Mike
In simple, We can use Above() function
or
sum({<EXPENSE_TYPE = {'EBITDA'}, Month = {'$(=Max(Month))'}>} AMOUNT) / sum({<EXPENSE_TYPE = {'EBITDA'}, Month = {'$(=Max(Month)-1)'}>} AMOUNT)
Or
sum({<EXPENSE_TYPE = {'EBITDA'}, Month = {'$(=Max(Month))'}>} AMOUNT) / sum({<EXPENSE_TYPE = {'EBITDA'}, Month = {'$(=AddMonths(Max(Month),-1))'}>} AMOUNT)
May be try this
Aggr(Sum({<EXPENSE_TYPE = {'EBITDA'}>} AMOUNT)/Above(Sum({<EXPENSE_TYPE = {'EBITDA'}>} AMOUNT)), EXPENSE_TYPE, Month)
But the above expression will depend on the sort order of your Month field. If it isn't sorted in the ascending order in the script, you will run into issues.
If you are using the chart for only one type of expense_type, why even add it as a dimension.... may be try this
Dimension
Month
Expression
Sum({<EXPENSE_TYPE = {'EBITDA'}>} AMOUNT)/Above(Sum({<EXPENSE_TYPE = {'EBITDA'}>} AMOUNT))
OK that didn't do it, it is just giving me values from 0-1 for all months, also I want to make sure that I can get this comparison to work for all months, not just the current months.