Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

soniasweety
Contributor III

how to use

Hi all,

Miguel Angel Baeyens de Arce

Bala Bhaskar

i want to use variable in alternate state expreession   below i tried but no luck   how to use?

=Sum({<[Name] -= {"=len(trim([Name]))=0"},[L1]=$::[L1],[SRn]=$::[SRn],FormatId=$::FormatId>}[Amount])
/$(vFormatId)



variable  is not workibng  here    but when i hardcode the value  its working   



if i use variable data not showing anything


//1000000
//$(vFormatId)
//only({<FormatId=$::FormatId>}FormatId)



variable:  vFormatId=FormatId


format id is field  and having values  1000000,1000



Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: how to use

If you make selection in FormatId in inherited state, then may be try this

=Sum({<[Name] -= {"=len(trim([Name]))=0"}, [L1] = $::[L1], [SRn] = $::[SRn], FormatId = $::FormatId>}[Amount])/Only({$} FormatId)

13 Replies
balabhaskarqlik
Honored Contributor

Re: how to use

May be try like this:

1. Change variable like:

vFormatId = Only(FormatId); use this in expr as: $(vFormatId)

OR

2. only({<FormatId=$::FormatId>}Amount)

OR

3. Aggr(Only({1<FormatId = p(FormatId)>}Amount),Amount)

vishsaggi
Esteemed Contributor III

Re: how to use

variable cannot hold multiple values at a time unless you use some Concat() or Aggregate functions like Min Max(). So when you divide sum()/$(formatid) what is the value you want to divide this by?

soniasweety
Contributor III

Re: how to use

formatid  is a field having two values  1000  and 1000000

i want to divide the value  sum()/1000  and 1000000

my report  need to show  millions and thousands  when user selects thousands it should show  thousands

and same for millions

soniasweety
Contributor III

Re: how to use

3 not working    null it is showing

soniasweety
Contributor III

Re: how to use

hi

Felip Drechsler

Marco Wedel

Sunny Talwar  do you have any help on this?

vishsaggi
Esteemed Contributor III

Re: how to use

‌so you have only two values in your field formatid 1000 and 100000. Why don’t you just use sum()/formatid did you try this way? Don’t use any variable.

soniasweety
Contributor III

Re: how to use

tried but its  also showing nothing

soniasweety
Contributor III

Re: how to use

Hi Bala Bhaskar   its not working i tried your 3 expressions

MVP
MVP

Re: how to use

So, FormatId is selected in the inherited state or another alternate state? The chart is in inherited state or Alternate State?