12 Replies Latest reply: Aug 25, 2015 4:45 PM by Cassandra Baqir

# GetCurrentField vs Set Analysis

I have a chart that has two expressions:

Calculate Total Spend to Date:

sum(ACT_AMT)/1000

Calculate current fiscal year spend:

=Sum({\$<FISCAL_YEAR_NUM={\$(=\$(vCurFY))}>}ACT_AMT)/1000

I have a new requirement that instead of hard coding the current fiscal year in the expression, the user shall be able to select the Fiscal Year (FY) from the list box (FISCAL_YEAR not FISCAL_YEAR_NUM) and the total displayed should show the total for only the selected year(s).

I thought I could use =GetCurrentField(FISCAL_YEAR) instead of {\$<FISCAL_YEAR_NUM={\$(=\$(vCurFY))}>} but that doesn't seem to work. I know that this is simple but my brain just isn't connecting the dots today.

Sample Attached. For example, clicking on FY16 (the current FY) works but FY15 does not.

Thanks!

Cassandra

• ###### Re: GetCurrentField vs Set Analysis

GetCurrentField(.. ) is used to get the active Field in a dimension (drill down or cyclic) group.

I think you are looking for

=GetFieldSelections(FISCAL_YEAR)

• ###### Re: GetCurrentField vs Set Analysis

Thanks, but that does not appear to work in my app for some reason.

=Sum(GetFieldSelections(FISCAL_YEAR)}>}ACT_AMT)/1000

• ###### Re: GetCurrentField vs Set Analysis

See attached.

variable p: =chr(39) & GetFieldSelections(FISCAL_YEAR)  & chr(39)

in chart:  =Sum({\$<FISCAL_YEAR_NUM={\$(p)}>}ACT_AMT)/1000

• ###### Re: GetCurrentField vs Set Analysis

That doesn't seem to be responding to my selection in FISCAL_YEAR list box

• ###### Re: GetCurrentField vs Set Analysis

It would be more like

=Sum({\$<FISCAL_YEAR={\$(=GetFieldSelections(FISCAL_YEAR))}>}ACT_AMT)/1000

But since QV considers selections in this field anyway for aggregations, the set expression wouldn't make much sense.

• ###### Re: GetCurrentField vs Set Analysis

=Sum({\$<FISCAL_YEAR={\$(=GetFieldSelections(FISCAL_YEAR))}>}ACT_AMT)/1000 seems to work. Are you saying it shouldn't?

The only issue I see is that it is showing 0 if none of the FYs are selected.

• ###### Re: GetCurrentField vs Set Analysis

you have almost similar data in ACT_AMT for all the years for some reason.Please check that.

If the Data in ACT_AMT if different then definitely the chart responds.

edit:

for some reason , the sum(ACT_AMT) is constant and list box values are also the same for all the years.

Thanks

• ###### Re: GetCurrentField vs Set Analysis

I think you may be having issues because of your data model.  The two tables in your model aren't linked.

• ###### Re: GetCurrentField vs Set Analysis

Not sure how that happened. I reloaded.

• ###### Re: GetCurrentField vs Set Analysis

Try changing your 'FY Spend' expression to

(ACT_AMT)/1000

• ###### Re: GetCurrentField vs Set Analysis

Duh!

• ###### Re: GetCurrentField vs Set Analysis

I noticed in the text box to the left, there was not a value being returned.  I thing you may need to use =GetFieldSelections(FISCAL_YEAR)

I do not know what impact if any that will/may have

Whenever I selected the different fiscal years, the data did not change - is the data that is shown for FY16?

based on the Help, it does not appear getcurrentfield is the correct function for what you are trying to achieve

GetCurrentField(groupname)

returns the name of the field currently active in the group named groupname.

Example:

getcurrentfield( MyGroup )