Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
carolinne88
Creator
Creator

Month before the selected one

Hello guys. I need help again.


I have the down table with the date fields and last month's variable (vMesRef).


vMesRef => PerID = {$(=Max(PerID))}


I need a variable that brings me the "MêsAno" before the selected one. I tried the variable "vMesRefAnt", but it does not work.


vMesRefAnt => PerID = {$(=Max(PerID)-1)}


Can someone help me?


tabela data.jpg


erro variável.jpg

Labels (1)
20 Replies
carolinne88
Creator
Creator
Author

None of the options solved.. =/

carolinne88
Creator
Creator
Author

I can not because I can not disclose the uploaded data.

pradosh_thakur
Master II
Master II

Try changing this in the variable

vMesRef => PerID = {"$(=Max(PerID))"}

vMesRefAnt => PerID = {"$(=Max(PerID)-1)"}


and


expression


The first object (with the number 52) is the expression      =Count ({<vMesRef>} Natureza_Jurídica)

The second object is the expression       =Count ({<vMesRefAnt>} Natureza_Jurídica)


please note : I have removed $() as variable is going to replace the modifier.



regards

Pradosh

Learning never stops.
MK9885
Master II
Master II

Count(<{PerID= {$(=Max(PerID))}>} Natureza_Jurídica)

lorenzoconforti
Specialist II
Specialist II

vMesRefAnt => PerID = {"=$(num(Max(PerID),'0')-1)}

carolinne88
Creator
Creator
Author

I tested all the options given and none serves.

lorenzoconforti
Specialist II
Specialist II

Could you please create two text boxes with the following and paste the results?

Textbox1:

=Max(PerID)


Textbox2:

=Max(PerID)-1



carolinne88
Creator
Creator
Author

text box.png

jonvitale
Creator III
Creator III

Hi Carolinne,

I have been trying to play around with your issue, and your code works for me on a made-up set of data.

I wonder if it has something to do with the way the PerId variable is represented. Why don't you try this.

In the data load, wherever you are loading this table, use a preceding load line like this:

     Num(Month(data)) as PerId_DateNum

The PerId_DateNum field should *look* the same on the table, but perhaps it's represented in a better way beneath the surface.

Then use the same variables with the new fields:

vMesRef => PerID_DateNum = {$(=Max(PerID_DateNum))}

vMesRefAnt => PerID_DateNum = {$(=Max(PerID_DateNum)-1)}

lorenzoconforti
Specialist II
Specialist II

To me it looks like then there shouldn't be anything wrong with your variable and set expression. The problem might be somewhere else

Can you please post what is the exact code behind the text box you have mentioned above in the post? Please copy and paste the whole code (I think what you pasted before was just a part of it)

erro+objeto.jpg