.png) amit_kothari
		
			amit_kothari
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		
			on 
    
	
		
		
		02-09-2024
	
		
		12:11 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - edited on 
    
	
		
		
		08-20-2024
	
		
		04:29 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		.png) Tristan
		
			Tristan
		
		
		
		
		
		
		
		
	
			
		
A typical business intelligence application stores numerical information including amounts. Typical amount examples include, Order Amount, Invoice Amount, Shipped Amount, etc.
With the global nature of business now-a-days, end-users want to view reports in their own currency or in a global/common currency as defined by their business. This presents a unique opportunity in BI to provide amounts in converted rates either by pre-storing or by doing on-the-fly conversions while displaying reports to users.
This article discusses three use cases on how to support Currency Conversion in Incorta.
1) First, define an internal session variable called MyCountry:
query(_IncortaMetadata.USER.COUNTRY,
      _IncortaMetadata.USER.LOGINNAME = $user,
      _IncortaMetadata.USER.TENANTID = 47
     )
2) Use the above variable and define a second internal session variable called MyGlobalCurrency. You can also do this by querying a table in incorta using a file which has this information:
query(
      if(
         $MyCountry = 'United States',
         'USD',
         if(
            in(
               $MyCountry,
               "Germany",
               "France",
               "Italy"
              ),
            'EUR',
            'USD'
           )
         )
     )3) In a dashboard, define a Presentation Variable called v_currcode and default its value to $MyGlobalCurrency :
If($v_currcode = PayablesTransactions.InvoiceHeaders.INVOICE_CURRENCY_CODE, 
   PayablesTransactions.InvoiceHeaders.INVOICE_AMOUNT,
   lookup(EBS_FIN_COMMON.GL_DAILY_RATES.CONVERSION_RATE,
          EBS_FIN_COMMON.GL_DAILY_RATES.FROM_CURRENCY,
          PayablesTransactions.InvoiceHeaders.INVOICE_CURRENCY_CODE,
          EBS_FIN_COMMON.GL_DAILY_RATES.CONVERSION_TYPE,
          'Corporate',
          EBS_FIN_COMMON.GL_DAILY_RATES.CONVERSION_DATE,
          PayablesTransactions.InvoiceHeaders.INVOICE_DATE,
          EBS_FIN_COMMON.GL_DAILY_RATES.TO_CURRENCY,
          $v_currcode,
          0) * PayablesTransactions.InvoiceHeaders.INVOICE_AMOUNT
  )sum(
    case(
         $CurrType = 'Global1',
         EBS_AR_SNP.AR_AGING.AMT * EBS_AR_SNP.AR_AGING.GlobalRate1 ,
         $CurrType = 'Global2',
         EBS_AR_SNP.AR_AGING.AMT * EBS_AR_SNP.AR_AGING.GlobalRate2,
         $CurrType = 'Global3',
         EBS_AR_SNP.AR_AGING.AMT.AMT * EBS_AR_SNP.AR_AGING.GlobalRate1,
         0.0
        )
   )sum(
    case(
         $CurrType = 'Document',
         EBS_AR_SNP.AR_AGING.AMT * EBS_AR_SNP.AR_AGING.DocRate,
         $CurrType = 'Functional',
         EBS_AR_SNP.AR_AGING.AMT * EBS_AR_SNP.AR_AGING.FuncRate,
         $CurrType = 'Global',
         EBS_AR_SNP.AR_AGING.AMT * EBS_AR_SNP.AR_AGING.GlobalRate,
         0.0
        )
   )