Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8507

Re: Null Records in scope when comparing category data

$
0
0

Hi Jim,

 

Variants:

 

1) 2 loops will do the job!

 

*SELECT (%TIME%,"[ID]", TIME, "[CURRENTPERIODS] = 'CURRENT_MONTH'")
*XDIM_MEMBERSET TIME = %TIME%
*XDIM_MEMBERSET ACCOUNT AS %ACCT% = BAS(ACCOUNT)
*XDIM_MEMBERSET ACCOUNT = %ACCT%

 

*XDIM_MEMBERSET CATEGORY = V1


*WHEN CATEGORY
*IS *
*REC(EXPRESSION = %VALUE% - ([CATEGORY].[V2]), ACCOUNT = DELTA, VERSION = V2)
*ENDWHEN

 

*XDIM_MEMBERSET CATEGORY = V2

 

*WHEN CATEGORY

*IS *

*REC(EXPRESSION = ([CATEGORY].[V1]) - %VALUE%, ACCOUNT = DELTA, VERSION = V2)

*ENDWHEN

 

2) Single loop:

 

*SELECT (%TIME%,"[ID]", TIME, "[CURRENTPERIODS] = 'CURRENT_MONTH'")
*XDIM_MEMBERSET TIME = %TIME%
*XDIM_MEMBERSET ACCOUNT AS %ACCT% = BAS(ACCOUNT)
*XDIM_MEMBERSET ACCOUNT = %ACCT%

 

*XDIM_MEMBERSET CATEGORY = V1,V2


*WHEN CATEGORY
*IS V1
*REC(EXPRESSION = %VALUE%, ACCOUNT = DELTA, VERSION = V2)

*IS V2

*REC(EXPRESSION = -%VALUE%, ACCOUNT = DELTA, VERSION = V2)

*ENDWHEN

 

Vadim

 

P.S. Second variant is better for this particular case (expression contains only "+" and "-" operators) but first one is universal. There is a third option - to use *WHEN_REF_DATA = MASTER_DATA  with the original code but I don't recommend it due to performance issues.

 

Message was edited by: Vadim Kalinin - P.S. Added


Viewing all articles
Browse latest Browse all 8507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>