Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it not possible to use GetCurrentField directly in an expression without using it in an IF statement like so:
Count(=GetCurrentField(CustomerTopTenCycle))
getcurrentfield return a value so you can use it in an expression ...
I'm not having any luck doing so. This is my actual expression:
Count(TOTAL {<[Fiscal Year]={'2012'}>} GetCurrentField(CustomerTopTenCycle))
If I replace the GetCurrentField function with the actual field name, it returns 35 which is correct, with the function in place, it only returns 1 for each row.
Yes, it's a value not a reference to a field but if your field name is myField you can
Count(TOTAL {<[Fiscal Year]={'2012'}, myField={'$(=GetCurrentField(CustomerTopTenCycle))'}>} myField)
let me know
"myField" is what is in question, as "myField" is determined by which field in the cycle is selected. Maybe I'm misunderstanding?
Is
Count(TOTAL {<[Fiscal Year]={'2012'}>} $(=GetCurrentField(CustomerTopTenCycle)))
Working ?
Thanks for the reply yadurand, but no, that doesn't work. It returns nothing with that syntax.
Strange
I reproduced your fields and group names in a qvw and what i pasted is working for me
Yeah, something isn't right on my end. I've tried two other cycle groups and get a result (35), but it stays the same for every field in the cycle on each group. I'm not sure if it's a Qlikview glitch, or if I'm missing something. I'll continue to investigate and update you. Thanks for your continued help.
I never did get this to work correctly. It would work with some fields in the group and not others and I couldn't determine why. I eventually went with an IF statement which didn't seem to have any real performance hit.
If(
GetCurrentField(Mon_Terr_CatSubSect_Cycle)='Ship To',
Count(TOTAL DISTINCT {1<[Fiscal Year]={'>=$(=FiscalCurrentYear-2)<$(FiscalCurrentYear)'}>} [Ship To])
,
If(
GetCurrentField(Mon_Terr_CatSubSect_Cycle)='Territory',
Count(TOTAL DISTINCT {1<[Fiscal Year]={'>=$(=FiscalCurrentYear-2)<$(FiscalCurrentYear)'}>} Territory)
,
If(
GetCurrentField(Mon_Terr_CatSubSect_Cycle)='Month',
Count(TOTAL DISTINCT {1<[Fiscal Year]={'$(FiscalCurrentYear)'},[Sales Amount]={'>0'}>} Month)
,
If(
GetCurrentField(Mon_Terr_CatSubSect_Cycle)='Sales Catalog Sub Section',
Count(TOTAL DISTINCT {1<[Fiscal Year]={'>=$(=FiscalCurrentYear-2)<$(FiscalCurrentYear)'}>} [Sales Catalog Sub Section])
))))
Thanks again for the suggestion.