Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How TO pass Dimension from Chart to Function Call Expression

I have an expression that takes a paramater as a value

In one of my charts the values in one of the dimensions are the names I would like to pass to my function. How Would you accomplish this?

$(FunctionName(PassDimension))??

12 Replies
Not applicable
Author

Can you be more specific? Do you have an example file of what you are trying to accomplish?

Not applicable
Author

Simple Example I created a function not the following the one i have is very long

v_Vk is Variable

v_Vk is defined as follows

     Sum({<X={$1}>}Value)

When Calling the function $(v_Vk(DimensionValue))

I want the DimensionValue to be the Charts Dimension value so I do no have to hard code through each Value thats needed to calculate

Not applicable
Author

Try something like

$(variable_name($(=field_name))

where variable_name is the name of your parameterized variable and field_name is the name of field containing the values to pass.

However, if you want a chart with user selected dimensions then your method of passing a value to a set analysis will not work (it will filter on the value, not have different dimension). To have user selected dimensions, use

$(=field_name)

in the calculated dimensioni in the chart where field_name contains the list of field names for the user to select.

Not applicable
Author

This is not getting resolved.

I have a Field_Name  dragged into my chart dimension and when i put this into the function it does not get resolved with the dimension in ther pivot table

Not applicable
Author

Why do you want the dimension value in the expression? The expression are calculated for each dimension value so there usually is no need to know the dimension value. If your chart has field_name as the dimension, the expressions will be calculated for every value in dimension.

Not applicable
Author

Unfortunatleyt Qlikview has no real way of calculating complex calculations and my equation is now working for PErcent rank for calculating returns over time through geometric linking.

qlikview doesnt have this capability and lacks alot of calculations and abilities and you can break its mold in minutes. I would of loved to not have to use this method of paramater but now I have no choce and need it. And the support that Qlikview offers in the past 5 months (Questions answered - 0)

This is the only thing i have left to finish

Not applicable
Author

Anyone Answer?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

There should be no problem passing the Dimension value to a function.  For example,

$(vFunction(DimField))

will pass the value of DimField to the variable function. However, based on your earlier post, it looks like you are trying to use the passed value in a Set expression.

Sum({<X={$1}>}Value)

Set expressions can't be modified on a row by row basis in this way. The Set is selected for the whole chart.

I'm guessing that what you are trying to accomplish is to widen the dimension for your calculation. That is, for a chart row with Dim1, Dim2, Dim3, you want to sum(Value) for Dim1. The correct way to do that is with an aggr() function.

=aggr(Sum(Value), Dim1))

Did I get it right? If not could you post some more details on the chart dims and specifically what you compute?

-Rob

http://robwunderlich.com

Not applicable
Author

I am using aggr the problem is without using the set analysis in the each item the value is incorrect


Solving for the following to be the same with and without the Set analysis


FirstSortedValue({<Inv={"=sum(aggr(exp(sum({<GroupName={$1}>} log(1+Pricing)))-1,Inv, GroupName)) <
$(=(exp(SUM(aggr(log(1+SUM({<GroupName={$1}>}Value1)/SUM({<GroupName={$1}>}Value2))
, GroupName, BusinessDate)))-1))
"}>}
(aggr(exp(sum({<GroupName={$1}>}log(1+Pricing)))-1,Inv, GroupName))
,-(aggr(exp( sum({<GroupName={$1}>} log(1+Pricing)))-1,Inv, GroupName))
)