Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Use dimensions in measure expression
trespass
<p>Hi all,</p><p> </p><p>I need to use dimension object into a measure expression. Once <span style="font-size:14px;">built the cube with, for example, YEAR dimension and AMOUNT measure, how can I add a new measure in a crosstab like:</span></p><p> </p><p>AMOUNT_NEW = AMOUNT / "NUMBER OF ROWS EXTRACTED FROM YEAR DIMENSIONS" ?</p><p> </p><p><span style="font-size:14px;">Is it possible? I can't find a way... I thought there was something like:</span></p><p> </p><p><span style="font-size:14px;">dimension[TIME][YEAR].count</span></p><p> </p><p><span style="font-size:14px;">thanks in advance,</span></p><p> </p><p>Massimo</p>
Find more posts tagged with
Comments
Hans_vd
<p>I believe you can do it like this:</p><p>- create a measure that uses function COUNT</p><p>- in the crosstab right click on a measure and choose Add Derived Measure</p><p>- you can now build an expression that will look - depending on how you named your dimensions and measures - something like this:</p><pre class="_prettyXprint">data["AMOUNT_dimYear/YEAR"] / data["MYCOUNT_dimYear/YEAR"]</pre>
trespass
<p>Hi,</p><p> </p><p>thanks so much for your answer, I've tried to create a measure with function COUNT referring to a DIMENSION, but it didn't work.</p><p>How can I create a cube measure referring to a dimension?</p><p>I've attached what I'm trying to do.</p><p> </p><p> </p><p> </p><p>regards,</p><p> </p><p>Massimo</p>
Hans_vd
<p>Why should it be "referring to a dimension"?</p><p>Is the dimension by which the amount is reported different from the dimension of the count you want it to be divided by?</p>
trespass
<p>No no, what I mean is how can I build the [color=rgb(0,136,0);font-size:14px;]"MYCOUNT_dimYear/YEAR" [/color]in your example?</p><p> </p><p>
</p><p> </p><p>thanks</p>
Hans_vd
<p>When you drag the measure to the crosstab, it will be automatically created. (You can hide it if you want by selecting "Show/Hide Measure" from the context menu)</p><p>Next step is then using that measure item in the the derived measure</p>
trespass
<p>But I'm not able to create a measure into the cube using "[color=rgb(0,136,0);font-family:helvetica, arial, sans-serif;font-size:14px;]dimYear/YEAR" [/color][font="helvetica, arial, sans-serif;font-size:14px;"]because it is a group (dimension)!
[/font][font="helvetica, arial, sans-serif;font-size:14px;"] [/font]</p><p> </p><p>Is there an alternative such as count extracted rows of a crosstab column?</p><p> </p><p> </p><p>many thanks</p>
Hans_vd
<p>I'm not saying you need to create a measure in the cube using a dimension.</p><p>Create a measure using function COUNT, it doesn't matter what field you put in the expression.</p><p> </p><p>Then, when you drag the measure in the <strong>crosstab</strong>, the dimYear/YEAR like stuff will be created. You can then - again in the <strong>crosstab</strong>, not the cube - create a Derived Measure where you can put an expression together using the crosstab measures that you already have in the crosstab.</p>
trespass
<p>thanks a lot! <span style="font-size:14px;">It works!</span></p><p><span style="font-size:14px;">a last question: how can I use a crosstab column called "XX" (not row) in a javascript?</span></p><p><span style="font-size:14px;">data["XX"] and row["XX"] refer to a single row, but if I want to put a crosstab column into an array, how could it be done?</span></p><p> </p><p><span style="font-size:14px;">example:</span></p><p> </p><p>new Array(column["XX"])</p><p> </p><p>thanks</p>
Hans_vd
<p>Hi trespass,</p><p>That's great!</p><p> </p><p>Don't know about the scripting.</p><p>Maybe it's better to start a new thread in this forum.</p><p> </p><p>Or maybe if you describe what it is you want to achieve, we can work out a solution that doesn't need this kind of scripting.</p>
trespass
<p>thanks again!</p><p> </p><p>I'll open a new thread about it.</p><p> </p><p>cheers</p>