Skip to main content
Question

Using Dynamic Reference in SELECT Minus Statement

  • March 10, 2025
  • 6 replies
  • 92 views

Forum|alt.badge.img+3

I have a metric dimensioned by Day and Project. I want to offset back a certain number of Days based on another Metrics Input (Project Length). The Project_Length metric is an integer metric dimensioned by Project only. Is there a way to dynamically offset the number of days back in a SELECT statement based on an input such that this?

 

 

 

I have several projects that start N number of workdays before the end of the month, so I am trying to calculate their start date for each month based on the number of days they take (Project_Length) 

6 replies

Nathan
Employee
Forum|alt.badge.img+12
  • Employee
  • March 11, 2025

Hi,

 

You can do this calculation (Day - Project Length) in a metric and use it in the select


Forum|alt.badge.img+3
  • Author
  • Author
  • March 11, 2025

Hi ​@Nathan Can you explain or provide an example of how I would do this calculation in another metric? Day is a dimension so I dont see how I could do this calculation outside of a select


Min Li
Master Helper
Forum|alt.badge.img+12
  • Master Helper
  • March 12, 2025

@LAS Can you modify your formula as below and see if it works?

if(Day.First_Workday, Day[Day.’Day of  Week’.Working_Days][Add: Project][select: Day - Project_Length]


[Add: Project]  is used to add dimension of Project to your metric


Forum|alt.badge.img+3
  • Author
  • Author
  • March 13, 2025

@Min Li Bright Point Thanks for this but unfortunately the Select can only subtract using a metric if the metric the formula is written is one dimensional


Nathan
Employee
Forum|alt.badge.img+12
  • Employee
  • March 13, 2025

you can do the metric by Day and Project, do Day - Project Length and select on that.

 

You can also do SHIFT() within your select but I try to avoid putting functions within modifiers


Min Li
Master Helper
Forum|alt.badge.img+12
  • Master Helper
  • March 17, 2025

@LAS I tried the method that ​@Nathan suggested and it worked. You can adjust your formula as shown below.

'16. Metric 2'[by constant: shift(Day,-'16. Project Length')]

'16. Metric 2' is your source metric dimensioned by day and project.