0

Custom Filter

Hi Team,

I’m trying to build a date filter in Pyramid that includes the following options:

  • Current Week
  • Last Week
  • Last Month
  • Last Year
  • Custom Range (with the ability to select a specific date range)

Could you please guide me on how to implement this? I’ve attached a screenshot showing the current setup where “Last Week” is selected.

Thanks in advance for your support!

2 replies

null
    • Customer Solutions Architect
    • Moshe_Yossef
    • 8 hrs ago
    • Reported - view

    First I would look at the calendar filter - it offers many fast selections for weeks, months, etc.

    Alternatively - you can use formulate to aggregate the desired dates.

    Lets assume the date column is called [data].[date].

    Today would be:

    [Data].[Date].currentPeriod

    and therefore current week (make sure you use the table Data and the column date in the context):

     

    Aggregate(
      FullWeek([Data].[Date].currentPeriod,1) /*use 2 for weeks to start on Monday*/
      )

    you save the formulate with the name current week.

    and similarly:

    /*Prev Week*/
    Aggregate(
      FullWeek(addDays([Data].[Date].currentPeriod,-7),1) /*use 2 for weeks to start on Monday*/
      )
    /*Prev Month*/
    Aggregate(
      FullMonth(addMonths([Data].[Date].currentPeriod,-1))
      )
    /*Prev Quarter*/
    Aggregate(
       FullQuarter(addQuarters([Data].[Date].currentPeriod,-1))
    )
    /*Prev Year*/
    Aggregate(
      FullYear(addYears([Data].[Date].currentPeriod,-1))
    )

    So now you have a group of formulations, and you still need to attend to the range option.
    To handle the range you need to create a couple of parameters using [data].[date] - From Date and To Date:

    Now the next calculation is Called Selected range, and is an aggregate of the range of dates between the 2 parameters:

    Now you can use a filter and only show these calculations.

     

    This mechanism will require that you use the range parameters even if you didn't select a range.

    In a present, this can also be managed, I'll add to this tomorrow.

    • VP Product Management
    • Ian_Macdonald
    • 3 hrs ago
    • Reported - view

    Hi 

    I'm going to disagree with Moshe here and say the first thing you should look at is the Time Calculations Wizard.

    This is accessed by selecting the Query Sub Menu on the ribbon, then clicking on the Time Calculation button. Choose the time based hierarchy you want to work with, in this case I'm using Full Month Name, generated as part of my model data flow using the Time Intelligence block.

    You are then presented with a selection panel where you can choose what time calculations you want by checking the appropriate box. the options you are provided with will depend on the time based hierarchy chosen. A flat hierarchy like Full Month Name will just give you Month based options, a regular hierarchy of say, Year--> Quarter --> Month --> Date will give you options from the date to year levels. Here I'm selecting Last Month, Last 3 Months and Last 12 Months and Current Month.

    Clicking Apply will create a number of custom lists and members in my Full Month Name hierarchy that I can then use in Rows, Columns or Filters. I this case I'm choosing Current Month, Last 3 Months and Last 12 Months to use in a filter.

    There is much more to explore in the Time Calculation Wizard, such as making the calculations sharable or parameterizing the calculations for dynamic adjustment at run time.

    Also, you can of course open the created calculations in Formulate, for example to change Last 6 Months to Last 7 Months etc.

    Here's the Help on it for further reading.

    Hope that helps.

    Ian

Content aside

  • 8 hrs agoLast active
  • 2Replies
  • 17Views
  • 3 Following