Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have this set analysis expression. It's supposed to return today's month and year if I have no selection at all (that's workin fine), if I select any date from 2011, is working fine also. But my table has data until february of 2012, when I select january/2012, the expression assumes that I have no month selected and return me today's month.
=If((IsNull(GetCurrentField(Mes))),(if(Max(Año)=Year(Today()),Month(Date(Today(),'MMM')),Date(Date#(Max(Mes),'MM'),'MMM'))),Date(Date#(Max(Mes),'MM'),'MMM'))
I don't know if I made my point clear, I'm kind of desperate because I don't know what else to do.
Thank you very much.
Juan,
the GetCurrentField() function is described in the Help as:
returns the name of the field currently active in the group named groupname.
So you need to state a groupname, not a field name, and it's only really useful when used in a chart object with a group used. I assume you want to use GetFieldSelections( Mes) or GetSelectedCount( Mes ) instead (latter will return 0 if no selections are made in field Mes).
Then I would recheck the if-then-else paths, I am not sure if all parentheses are set correctly.
Not sure if this will explain what you see. If not, could you upload a small sample?
Regards,
Stefan
Hi Juan,
I would think you need to set a variable to your maximum date ie: vMaxDate = MAX((YourDateValue)
then test your date against this variable using Set Analysis in your objects.
=SUM( {$< YourDateValue = {'$(vMaxDate)'} >} YourValue)
This will always display the most current date range of data even if you change your filters. You can adjust the above if you want to limit to Month/Year or what ever.
John.
This is the expression in my gauge chart
=(Count({$< Año={$(=Max(Año))}, Mes={$(=Date(Date#(Max(Mes),'MM'),'MMM'))} >}[Identificación afiliado]) - Count({$<Año={$(=If(Date(Date#(Max(Mes),'MM'),'MMM')='ene',Max(Año-1),Max(Año)))}, Mes={$(=If(Date(Date#(Max(Mes),'MM'),'MMM')='ene','dic',Date(Date#(Max(Mes-1),'MM'),'MMM')))} >}[Identificación afiliado])) / Count({$<Año={$(=If(Date(Date#(Max(Mes),'MM'),'MMM')='ene',Max(Año-1),Max(Año)))}, Mes={$(=If(Date(Date#(Max(Mes),'MM'),'MMM')='ene','dic',Date(Date#(Max(Mes-1),'MM'),'MMM')))} >}[Identificación afiliado])
now, I've created this variable in order to validate the selections
=If(IsNull(GetCurrentField(Mes)),if(Max(Año)=Year(Today()),Month(Date(Today(),'MMM')),Date(Date#(Max(Mes),'MM'),'MMM')),Date(Date#(Max(Mes),'MM'),'MMM'))
How can I use that in order to get today's value when there is no selection made at all???