Announcements
cancel
Showing results for
Did you mean:
Contributor III

## Help on Set analysis

Hi Community,

I am trying to use below function as expression in a straight table

=Count({<PeriodCode={\$(=FieldValue('PeriodCode',FieldIndex('Period',GetFieldSelections(Period)))-1)}>}Period)

but it doesnt work

however without '-1' it works

regards

1 Solution

Accepted Solutions
MVP

Try like:

=Count({<Period,PeriodCode={\$(=FieldValue('PeriodCode',FieldIndex('Period',GetFieldSelections(Period)))-1)}>}Period)

14 Replies
Specialist III

May be this:

=Count({<PeriodCode={"\$(=Num(FieldValue('PeriodCode',FieldIndex('Period',GetFieldSelections(Period))))-1)"}>}Period)

Along with this, could you please check what below function is returning? This will help you to identify the root cause.

=FieldValue('PeriodCode',FieldIndex('Period',GetFieldSelections(Period)))

Regards!

Rahul Pawar

Let's assume

FieldIndex('Period', GetFieldSelections(Period)) -- 4 // Assuming, you are selecting 4th record from Period Table

FieldValue('PeriodCode', 4) -- ABC // May be 4th place of PeriodCode is ABC

Then how you need ABC - 1 ???

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MVP

If you are looking for the earlier indexed value count of the field, you may try with a bracket correction like:

=Count({<PeriodCode={\$(=FieldValue('PeriodCode',FieldIndex('Period',GetFieldSelections(Period))-1))}>}Period)

Contributor III
Author

Dear Rahul Pawar

unforetunately it didnt wotk

i checked (=FieldValue('PeriodCode',FieldIndex('Period',GetFieldSelections(Period))))

it works

regard

Contributor III
Author

Dear Anil Babu Samineni

the Format of PeriodCode is number.  as a resault FieldValue('PeriodCode', 4) return number not string

i checked (FieldIndex('Period', GetFieldSelections(Period))-1 )

it works correctly

regard

Contributor III
Author

Dear Tresesco

i try that

it didnt work unfortunately

regard

Will you able to provide work file to test?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

Can you provide sample apps???

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
MVP

Can you add the expression to your table as a new column with no label.

Then if you hover over the column header you can see how the variables in your set expression are being evaluated, which may help identify the problem.

Community Browser