colinmrice
-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Security Advisories
Downloads
Posts posted by colinmrice
-
-
Code: Hi,
I have an ETL job that uses the tMap control to map a BigDecimal input field to a BigDecimal output field. The result in the output field should be Raw.TranAmount * 0.07, as seen below:
Raw.TransactionType == 1 && Raw.AgentNo > 100000 ? Raw.TranAmount * 0.07 : 0
However I get java compilation errors saying that 'The operator * is undefined for the argument type(s) BigDecimal, double'. If I try the following:
Raw.TransactionType == 1 && Raw.AgentNo > 100000 ? 10 * 0.07 : 0
that works fine, so I know it is just having a problem multiplying the value from field Raw.TranAmount with 0.07.
I've tried various java/groovy functions like .multiply but still no good. Surely someone must have needed to do this before. Any suggestions?
Thanks
Colin
-
Code: <CalculatedMember name="Transactions TransType1" formula="COALESCEEMPTY((Measures.[Total TransactionAmount], [TransactionType].[TransactionType].[TransID].[1]), Measures.[Total TransactionAmount])" dimension="Measures" visible="true">
</CalculatedMember>
<CalculatedMember name="Transactions TransType2" formula="COALESCEEMPTY((Measures.[Total TransactionAmount], [TransactionType].[TransactionType].[TransID].[2]), Measures.[Total TransactionAmount])" dimension="Measures" visible="true">
</CalculatedMember>
<CalculatedMember name="Transactions TransType6" formula="COALESCEEMPTY((Measures.[Total TransactionAmount], [TransactionType].[TransactionType].[TransID].[6]), Measures.[Total TransactionAmount])" dimension="Measures" visible="true">
</CalculatedMember>
<CalculatedMember name="Transactions TransType97" formula="COALESCEEMPTY((Measures.[Total TransactionAmount], [TransactionType].[TransactionType].[TransID].[97]), Measures.[Total TransactionAmount])" dimension="Measures" visible="true">
</CalculatedMember>
<CalculatedMember name="Gross Sales GameType1" formula="([Measures].[Transactions TransType1] + [Measures].[Transactions TransType2] + [Measures].[Transactions TransType6] - [Measures].[Transactions TransType97])" dimension="Measures" visible="true">
</CalculatedMember>
<CalculatedMember name="Gross Sales GameType2" formula="([Measures].[Transactions TransType1] + [Measures].[Transactions TransType2])" dimension="Measures" visible="true">
</CalculatedMember>
<CalculatedMember name="Gross Sales GameType3" formula="([Measures].[Transactions TransType1] + [Measures].[Transactions TransType2])" dimension="Measures" visible="true">
</CalculatedMember>
-
Hi,
I'm new to this forum and looking for some help defining a calculated member (of even if that is the way I should be doing it).
I'm looking for some help with building a formula in a Calculated Member in my cube. I have the dimensions and fact entries defined in my cube, and the data is displayed correctly in the MDX query test.
What I need to do is create a Calculated Member that will return the gross sales based on a calculation using my existing dimensions. I'm new to MDX and formulas so just looking for some pointers. Please see the attached file that hopefully explains what I'm trying to do.Thanks in advance!
Colin
How to multiply field values by a number
in Products
Posted
Found a resolution to this on the Talend forge forum:
Raw.TransactionType == 1 && Raw.AgentNo > 100000 ? Raw.TranAmount.multiply(BigDecimal.valueOf(0.07)) : new java.math.BigDecimal(0)