15 Replies Latest reply: Dec 6, 2017 9:31 AM by Shahbaz Khan Mohammed

# Calculated Dimension

Hi All,

I am trying to use percentage calculation in my visualization as a dimension.

((Curr_Value-Pre_Value)/Prev_Value)*100

How can I do it?

Thanks

• ###### Re: Calculated Dimension

I tried using

aggr(((\$(vDiff_value)/\$(Prev_Value))*100),Percentage_change) as dimension but it shows no data generated for any of the measure. But If I check null values, it shows 143 as null value and I am trying to implement it in bar chart.

• ###### Re: Calculated Dimension

Do it in the script if it work?

This may work if you have Curr_Value and Prev_Value in your table already...

((Curr_Value-Pre_Value)/Prev_Value)*100 as Calculated_Dim

Use Calculated_Dim in frontend

• ###### Re: Calculated Dimension

Do I need to add If condition?  and also I have variables defined for the difference in value and previous value also

• ###### Re: Calculated Dimension

I am using vCurr as the Diiference and vPrev for the previous value.

• ###### Re: Calculated Dimension

I am using variables vCurr and vPrev for the difference and previous value simultaneously and I have access to script

• ###### Re: Calculated Dimension

what is vCurr and vPrev?

I mean what expression o these variables have?

• ###### Re: Calculated Dimension

Hey S,

To make it easy, I made these variables as vchange which will give me a percentage value.There is no dimension to use it.I wanted to use this in my alternated dimension and I have 6 different measures...Count of x,count of y,Sum (x+y),count of M,count of D across bar chart.

How can we do it?

• ###### Re: Calculated Dimension

Can we have sample data please?

It is hard to understand...

All I understood is you are looking to create a new dimension from that measure

But what is the expression used in those variables? Not sure if there is a possibility to create a calculated dimension in script.

• ###### Re: Calculated Dimension

This may also work, if you do not have access to the script:

num((sum(Curr_Value)-(sum(Pre_Value)))/sum(total Prev_Value), '#,##0%')

• ###### Re: Calculated Dimension

Chris does not work as I have to use this as dimension

• ###### Re: Calculated Dimension

The OP said you wanted to use it as a measure?

• ###### Re: Calculated Dimension

Sorry , I changed it to dimension.