Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
dena_reavis
Employee
Employee

Only function in an element set in set analysis?

Hello experts, please help me solve this problem, which is very  likely that I messed up the syntax...

The purpose of this is to dynamically label columns of pay period data, with the number of the pay period or name. There is only one current pay period at a time, which I am using to get the Pay Period ID.

This works for the current PayPeriodID, returns 272 for the PayPeriodID

=Only({$<CurrentPayPeriod={"1"}>} PayPeriodID)

But I want to label the column with a friendly pay period label for pay period 272, the PayPeriodNumber, and be able to get this for the previous pay periods. So I thought I could use the Only function in the element set. Maybe I can't do that or I have the syntax wrong. I can't figure it out.

=Only({$<PayPeriodID={"<=$(=Only({$<CurrentPayPeriod={"1"}>} PayPeriodID))"}>} PayPeriodNumber)

and I thought I could later subtract 1 from the PayPeriodID to get the previous pay period for each label. I am entering these as separate expressions on each label, of each expression. 

This is some of the data. You can see I can't just subtract 1 from the Pay Period Number because it wouldn't capture the pay period before Pay Period 1 and when prior pay periods are in a different fiscal year.  Here is an inline load of some of my data.

Thanks for any help!! By the way, if there's a better way to do this, please let me know. Thank you!!

LOAD * INLINE [

    CurrentPayPeriod, PayPeriodNumber, PayPeriodEndDate, PayPeriodID

    0, 25, 9/3/2016, 259

    0, 26, 9/17/2016, 260

    0, 1, 10/1/2016, 261

    0, 2, 10/15/2016, 262

    0, 3, 10/29/2016, 263

    0, 4, 11/12/2016, 264

    0, 5, 11/26/2016, 265

    0, 6, 12/10/2016, 266

    0, 7, 12/24/2016, 267

    0, 8, 1/7/2017, 268

    0, 9, 1/21/2017, 269

    0, 10, 2/4/2017, 270

    0, 11, 2/18/2017, 271

    1, 12, 3/4/2017, 272

    0, 13, 3/18/2017, 273

    0, 14, 4/1/2017, 274

];

11 Replies
dena_reavis
Employee
Employee
Author

Its Above!

Thank you for everyone's help. (I feel like such a dunce but still grateful to the community.)

thank you,

Dena

sunny_talwar

Try this

If(RowNo(TOTAL) > 3, RangeAvg(Above(TOTAL Only({<PayPeriodID, PayPeriodNumber>} Value), 0, 4)))

Capture.PNG