0 Replies Latest reply: Jul 14, 2017 10:06 AM by Kyle Luckow RSS

    Using GetFieldSelections in Dynamic Replace Function

    Kyle Luckow



      I currently use a replace function in Qlik Sense to allow users to select KPIs from a List Box from dynamic expressions in my load script.  EventType is common in all of my formulas so I use a replace function to add in different time flags.


      $(=replace(only({1<FormulaOrder={"$(=min(FormulaOrder))"}>} Formula), 'EventType', 'CurrentYearToDate = {1}, EventType'))



      I've recently added the date range picker extension and want to leverage the user selection range for current and prior year calculations.


      I was thinking I may be able to leverage the GetFieldSelections and a replace function to get what I need.  On top of that I would need to add it into the existing replace function I already use.


      I was thinking I could combine the above with this type of replacement but I'm not even close to getting it to work.



      End goal would look something like this


      $(=replace(only({1<FormulaOrder={"$(=min(FormulaOrder))"}>} Formula), 'EventType', 'CalendarDate =replace((GetFieldSelections(CalendarDate)),[Year(Today())],'Year[Today())-1]), EventType'))

      Any ideas?