Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone,
I am using firstsortedvalue function to pick up last value in date field for a particular month. But I would like to combine this with sum function. What I want is, in the attached example, when more than two plants are selected, my graph should display value which is the sum of last value of date field of that particular month combining both plants (sum). How can I achieve this?
Any suggestion?
Thank you.
Another approach to check first date of the month:
If(Month(Date#(POPER_NEW, 'MMM'))>=month(today()) or WeekShort>=Today()
,Sum(Aggr(If(WeekShort=Min(TOTAL <Plant> WeekShort), Sum({<KPI={"Inventory_New"}>}[w/o BB]))
, Plant, WeekShort))
,Sum(Aggr(
If(WeekShort=Min(TOTAL <Plant> WeekShort),
Sum({<KPI={"Inventory_New"}>}[ACT Inventory weekly LC])-Sum({<KPI={"Inventory_New"}>}[AOP Inventory monthly LC]))
, Plant, WeekShort))
)
Hi, you can try with:
Sum(Aggr(FirstSortedValue(DISTINCT{<[ACT vs AOP]={'>0'}, Date={'<=$(=Today())'}>}[ACT vs AOP],-Date), [$(=GetCurrentField(@Time))], Plant))
Just suggest to add the set analysis from the inner aggregation to the outer one
Sum({<Date={'<=$(=Today())'}>} Aggr(FirstSortedValue(DISTINCT{<[ACT vs AOP]={'>0'}, Date={'<=$(=Today())'}>}[ACT vs AOP],-Date), [$(=GetCurrentField(@Time))], Plant))
Right, things of quick-answering
I didn't checked but, shouldn't be all set analysis?
Sum({<[ACT vs AOP]={'>0'}, Date={'<=$(=Today())'}>} Aggr(FirstSortedValue(DISTINCT{<[ACT vs AOP]={'>0'}, Date={'<=$(=Today())'}>}[ACT vs AOP],-Date), [$(=GetCurrentField(@Time))], Plant))
Ya that's true
It's working! Thank you very much Ruben
Whose answer should I mark as right one now?
Quick question on this again. How will I get this to work in an "if" "else" statement written below?
if(GetFieldSelections(WeekShort)>=month(Date#(WeekShort,'MMM')) or Month(Date#(POPER_NEW, 'MMM'))>=month(today())
,FirstSortedValue(DISTINCT {<KPI={"Inventory_New"}>}[Risk/ Challenge - Bank Builds],-Date)
,if(GetFieldSelections(WeekShort)<month(Date#(WeekShort,'MMM')) or Month(Date#(POPER_NEW, 'MMM'))<month(today())
,FirstSortedValue(DISTINCT {<KPI={"Inventory_New"}>}[BB ACT monthly LC]-[BB FC monthly LC],-Date)))
Thank you.
Hi Apoorva, I'm not sure if taking the aggr outside the expression can work, and what dimensions should be used as parameters in that case. Can you upload a sample to test?
Btw, I don't think "GetFieldSelections(WeekShort)>=month(Date#(WeekShort,'MMM'))" is working, what has to do this filter?
Hi Ruben,
I have uploaded the sample.
WeekShort field has dates as its values. What that condition does is, when a value selected in WeekShort is greater than or equal to current month then do so and so...Complete expression is available in the attached sample.
Thank you.