Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the original code as such and it works:
if(GetFieldSelections([Product]) = 'A', avg(123), if(GetFieldSelections([Product]) = 'B', avg(525), avg(346)))
However, now I need to add an additional field selections for year and it doesn't work. It just not able to recognize this field name. I tried with/without '2022', but still didn't work.
if(GetFieldSelections([Product]) = 'A' and GetFieldSelections(Year(Date))='2022', avg(123), if(GetFieldSelections([Product]) = 'B' and GetFieldSelections(Year(Date))='2022', avg(525), avg(346)))
I just tried this - NUM(Year(date#(GetFieldSelections(CreatedDate),'YYYY')))
but it is not working too.
Try this,
=if(GetFieldSelections([Product]) = 'A' and Year(GetFieldSelections( Date))='2022', avg(123), if(GetFieldSelections([Product]) = 'B' and Year(GetFieldSelections( Date))='2022', avg(525), avg(346)))
( OR )
=if(GetFieldSelections([Product]) = 'A' and
Year(Date(Date#(GetFieldSelections(Date),'DDMMYYYY'),'DDMMYYYY'))='2022', avg(123),
if(GetFieldSelections([Product]) = 'B' and
Year(Date(Date#(GetFieldSelections(Date),'DDMMYYYY'),'DDMMYYYY'))='2022', avg(525), avg(346)))
If there is any format issue, better to fix it at script level and use option1 to get desired result
Thanks,
Sasi
Why not just creating appropriate period-fields within the calendar and accessing them directly where needed instead of doing all the converting/formatting stuff by each call again and again.
- Marcus