Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can someone tell me a way to calculate the difference between two different months that are selected?
I know the way to find and aggregation between two different months but it's hard for me to find a difference.
fx --> GetFieldSelections([ORDER_DT.autoCalendar.Month], ',', 2)
Thank you
Hi June, maybe looking for the difference between max and min:
Max(DateField)-Min(DateField) --> Would return the difference in days
Or: Month(Max(DateField)) - Month(Min(DateField))
Or: Max([ORDER_DT.autoCalendar.Month]) - Min([ORDER_DT.autoCalendar.Month])
Thanks for the reply,
but I'm actually looking for the difference between SalePrice of two different months.
Thank you
Hi, then you can use set analisys to filter, in example, using a numeric YearMonth field:
Sum({<YearMonth={'$(=Max(YearMonthField))'}>} Sales)-Sum({<YearMonth={'$(=Min(YearMonthField))'}>} Sales)
Or this:
FirstSortedValue(Aggr(Sum(Sales), [ORDER_DT.autoCalendar.Month]), -Aggr([ORDER_DT.autoCalendar.Month], [ORDER_DT.autoCalendar.Month])) - FirstSortedValue(Aggr(Sum(Sales), [ORDER_DT.autoCalendar.Month]), Aggr([ORDER_DT.autoCalendar.Month], [ORDER_DT.autoCalendar.Month]))