Jump to content
  • 0

Calculated Field based on Date Range


eunha
 Share

Question

Hello! I have a calculated field that obtains the sum of my records. Is it possible to add a condition that will calculate the sum based on the date range inserted in my search form?

SELECT SUM(Total) FROM Tbl1 WHERE ID = target.[@field:ID] 

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

Hola! Yes, this is possible. First, you need to edit the On Exit field of your Criteria 1 & 2 into [@from] and [@to] respectively.

image.png.4159eb09c0a665bed56c8c1c219044b5.png

image.png.679a9a6ad74859760366f8231bef2ee1.png

Then, your formula should be like this. You need to add the condition that will scan the values of the date range you entered. Make sure to replace the 'Date' with the name of your Date field.

SELECT SUM(Total) FROM Tbl1 WHERE ID = target.[@field:ID] AND Date >= CAST('[@from]' AS datetime) AND  Date <= CAST('[@to]' AS datetime)

Cheers! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...