Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using variables in chart expression

Hi everyone,

I defined the following variables:

- vPraticheCaricateMeseCorr = count({< FlagCaricatoLiquidato={'Caricato'}, AnnoMese = {$(=$(vMaxAnnoMese))}>} distinct ContrattoID)

- vPraticheCaricateMesePrec = count({< FlagCaricatoLiquidato={'Caricato'}, AnnoMese = {$(=$(vMaxAnnoMesePrec))}>} distinct ContrattoID)

Then I used the variables in a chart expression as follows:

($(vPCaricateMeseCorr)-$(vPCaricateMesePrec))

/

($(vPCaricateMesePrec))

The chart is a pivot table with one dimension and multiple expressions besides the one I have shared with you.

Every works fine.

However, if I change the variables definition as:

- vPraticheCaricateMeseCorr =

if(GetSelectedCount(AnnoMese)>0,

count({< FlagCaricatoLiquidato={'Caricato'}, AnnoMese = P(AnnoMese)>} distinct ContrattoID),

count({< FlagCaricatoLiquidato={'Caricato'}, AnnoMese = {"$(=Max(AnnoMese))"}>} distinct ContrattoID)

)

- vPraticheCaricateMesePrec =

if(GetSelectedCount(AnnoMese)>1,

null(),

count({< FlagCaricatoLiquidato={'Caricato'}, AnnoMese = {$(=$(vMaxAnnoMesePrec))}>} distinct ContrattoID)

)

The expression in the chart stops working and shows '-' for all rows.

I think there is a problem with the dollar sign expansion but I am not able to solve it. So far I have tried to add brackets like:

(($(vPCaricateMeseCorr))-($(vPCaricateMesePrec)))

/

($(vPCaricateMesePrec))

which does not work and also

($(=$(vPCaricateMeseCorr)-)$(=$(vPCaricateMesePrec)))

/

($(=$(vPCaricateMesePrec)))

but the last attempt is showing the total in all rows of the table, which happen even if I add the "=" sign in front of the variable definition.

Any suggestion?

Thanks in advance,

Stefania

4 Replies
m_woolf
Master II
Master II

Have you put your 2 expressions into a text box to see their values? I'm guessing one of them is null.

Anonymous
Not applicable
Author

Yes I have .. both of them are not null.

Gysbert_Wassenaar

Why are you using if(GetSelectedCount(AnnoMese)>0 in the first expression and if(GetSelectedCount(AnnoMese)>0 in the second expression?

It would help if you could post a small example qvw file that demonstrates the issue.


talk is cheap, supply exceeds demand
pradosh_thakur
Master II
Master II

may be change this


- vPraticheCaricateMesePrec =

if(GetSelectedCount(AnnoMese)>1,

0,

count({< FlagCaricatoLiquidato={'Caricato'}, AnnoMese = {$(=$(vMaxAnnoMesePrec))}>} distinct ContrattoID)

)

Learning never stops.