Jump to content
  • 0

How can I produce one record as the difference between two others?


vidierre

Question

I try to make simple my question. I have table_a with these fields

  • PERIOD   -  contains a text with a period that start from January for each quarter, like JAN-MAR, JAN-JUN, JAN-SEP, JAN-DEC
  • VALUE_ 1  - a numeric value
  • VALUE_ 2  - a numeric value
  • ....
  • VALUE_ n  - a numeric value

I need to build a real quarter table_b where I have a record for JAN-MAR, APR-JUN, JUL-SEP, OCT-DIC. This imply that

  • for the 1st quarter the record of table_b will be with vaules of JAN-MAR that will be the same of one in table_a
  • for the 2nd quarter the record of table_b will be with vaules of APR-JUN as result from record JAN-JUN less record JAN-MAR
  • for the 3rd quarter the record of table_b will be with vaules of JUL-SEP as result from record JAN-SEP less record JAN-JUN
  • for the 4th quarter the record of table_b will be with vaules of OCT-DEC as result from record JAN-SEP less record JAN-DEC

I do not know if trigger can be useful or if I need to code something else.....

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Actually, I highly suggest that you create a formula field on table_A first that will specify which quarter it is.

Kindly make this formula:

Case 
When [@field:Label] = 'Jan' OR [@field:Label] = 'Feb' OR [@field:Label] = 'Mar'
then 'Q1'
When [@field:Label] = 'Apr' OR [@field:Label] = 'May' OR [@field:Label] = 'Jun'
then 'Q2'
When [@field:Label] = 'Jul' OR [@field:Label] = 'Aug' OR [@field:Label] = 'Sep'
then 'Q3'
When [@field:Label] = 'Oct' OR [@field:Label] = 'Nov' OR [@field:Label] = 'Dec'
then 'Q4'
End

It will then give you this in table A:

Seperate record per quarter.png
 

Link to comment
Share on other sites

  • 0
5 hours ago, NiceDuck said:

Then we can use a more reliable and simpler Task:

6615187

Thank for this quick suggestion. I'll study it a little and will reply soon providing some data sample.
Read carefully my question because we cannot aggregate or SUM data from table_a. This table does not contains quarter data, but data of a period from the beginning of year until the end of a quarter (remember JAN-MAR, JAN-JUN, JAN-SEP, JAN-DIC)

We need to subtract data of table_a from a record (i.e. the JAN-SEP) fro the previous (i.e. JAN-JUN) to obtain value of a quarter (i.e. JAN-SEP - JAN-JUN = JUL-SEP).

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...
×
×
  • Create New...