How to Create a Text Value for a label out of an IFS() Expression

I am new to AppSheet but I am trying to create a โ€œLabelโ€ Out of an IFS() expession. Basically if it returns True I want a Label that says โ€œThis Pay Periodโ€. I am pulling the info from a range of dates and comparing them to a list of dates. I have tried everything I can think of from the simple Display Value to changing the formula. On my app View it just says [Blank]?
Here is what I have so far.

IFS([Date] >= any(select(Pay Periods[Start Date],True)), [Date] <= any(select (Pay Periods[End Date], true)))

Solved Solved
1 9 372
1 ACCEPTED SOLUTION

Hey @Ray_Bibby

This is something I do all the time, hereโ€™s the general setup I typically have for the following scenario:

  • I have a table that holds records of Timesheets
    • Inside that table, there is a Date column
  • I have a table that holds the start and end date of each pay period
    • I have made a slice pulling out the โ€œCurrent_Pay_Periodโ€ with a formula like this:

And(
TODAY() >= [Pay_Period_Start_Date],
TODAY() <= [Pay_Period_End_Date]
)

If I wanted to create a label for each Timesheet row, that showed whether or not the timesheet was inside the โ€œCurrent_Pay_Periodโ€ slice, I would use a formula like this:

IFS(and(
  [Timesheet_Date] >= INDEX(Current_Pay_Period[Pay_Period_Start_Date], 1), 
  [Timesheet_Date] <= INDEX(Current_Pay_Period[Pay_Period_End_Date], 1)
),
  "This Pay Period"
)

This will either have the text shown above (if the condition is TRUE), or it will be blank (if the condition is FALSE - meaning the timesheet date is NOT inside the current pay period).


Is that something like what you were thinking?

View solution in original post

9 REPLIES 9

@Ray_Bibby
ANY() expression pulls out the very first item in a list. So provided you are trying to sort out particular date range, this may not work as expected.

May I ask what exactly do you mean with the word: โ€œLabelโ€? Are you trying to create a table grouping header or are you trying to construct a label for a table to use as the REF column labelling?

Yes I am trying to create a table grouping header for โ€œThis Pay Periodโ€ and then another for โ€œLastโ€ or โ€œPast pay Periodsโ€ and maybe even have it track the hours worked for the โ€œThis Pay Periodโ€.

Steve
Platinum 4
Platinum 4

For reference:



Hey @Ray_Bibby

This is something I do all the time, hereโ€™s the general setup I typically have for the following scenario:

  • I have a table that holds records of Timesheets
    • Inside that table, there is a Date column
  • I have a table that holds the start and end date of each pay period
    • I have made a slice pulling out the โ€œCurrent_Pay_Periodโ€ with a formula like this:

And(
TODAY() >= [Pay_Period_Start_Date],
TODAY() <= [Pay_Period_End_Date]
)

If I wanted to create a label for each Timesheet row, that showed whether or not the timesheet was inside the โ€œCurrent_Pay_Periodโ€ slice, I would use a formula like this:

IFS(and(
  [Timesheet_Date] >= INDEX(Current_Pay_Period[Pay_Period_Start_Date], 1), 
  [Timesheet_Date] <= INDEX(Current_Pay_Period[Pay_Period_End_Date], 1)
),
  "This Pay Period"
)

This will either have the text shown above (if the condition is TRUE), or it will be blank (if the condition is FALSE - meaning the timesheet date is NOT inside the current pay period).


Is that something like what you were thinking?

Perfect that is exactly what I am looking for However I still am not getting a Heading for the group Just a Y? Like This.

I do this in a two step process (for easy changes).
3X_7_1_710cf250560c171dc087267f6adc13b20458356f.png

3X_a_d_ade43b0315f64b04e284f6b29374b1131c490379.png

3X_f_4_f428c069b9ee6369ef6fec3c7297e66b6ce21b49.png

3X_5_2_523920355ec34a0d0f38cd1ec611ffddf0a77b7f.png

That would be because the ending portions of your If statements are conditions, not text values.

If you look at the sample formula I gave, youโ€™ll see that the โ€œtrueโ€ protion of the IF() is a text value; where the โ€œtrueโ€ value for Daves

his is a condition.

Conditions result in either TRUE or FALSE - thatโ€™s why you see a Y/N.

This is great @MultiTech_Visions , I have used the Formula and it works great, then I added to it a bit to make a seperate heading for โ€œPast Pay Periodsโ€ and when I test it the formula works great but I get a heading of โ€œBlankโ€ again instead of โ€œPast Pay Periodsโ€

Here is the formula I have
IFS(and(
[Date] >= INDEX(Current Pay Period[Start Date], 1),
[Date] <= INDEX(Current Pay Period[End Date], 1)
),
โ€œThis Pay Periodโ€
,
and( [Date] >= INDEX(Current Pay Period[Start Date], 2),
[Date] <= INDEX(Current Pay Period[End Date], 2)
),
โ€œPast Pay Periodsโ€

)

Untitled.pdf (62.1 KB)

By the way thank you everyone @LeventK, @MultiTech_Visions, @Steve, @Bahbus. Great info and great Community.

Top Labels in this Space