Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
antoniodneto
Creator II
Creator II

Help with Addmonths

Hi Guys

I have this expression to the value of my MAX DATE FIELD.

=sum({$<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'},DATA_BASE_FINAL={"$(=(MAX(DATA_BASE_FINAL)))"} >} EAD_ATUAL)/1000000

How Can I write another expression returning the previous month of MAX DATE?

I'm trying using Addmonths but not sucess. You guys think another way to solve that?

Tks a lot!

1 Solution

Accepted Solutions
OmarBenSalem
Partner
Partner

Try:

Above(

sum({$<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'} >} EAD_ATUAL)/1000000

)

 

per analogy:Capture.PNG

 

View solution in original post

11 Replies
OmarBenSalem
Partner
Partner

DATA_BASE_FINAL={"$(=addmonths(MAX(DATA_BASE_FINAL),-1))"}

antoniodneto
Creator II
Creator II
Author

Hi Omar,

Is not working.

 

=sum({<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'},DATA_BASE_FINAL={"$(=addmonths(MAX(DATA_BASE_FINAL),-1))"}>}EAD_ATUAL)/1000000

Display 0

OmarBenSalem
Partner
Partner

What's ur aim? What do u want to do?

antoniodneto
Creator II
Creator II
Author

I have a Bar Chat.

My first bar is with the expression =sum({$<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'} >} EAD_ATUAL)/1000000

It works returning the values of each month.

I want to plot another bar with the previous month value

For example

First bar 

Date = 201812 = 500k

Date = 201811 = 400k

My second bar should return the previous month value.

Date = 201812 = 400k (value for 201811).

 

OmarBenSalem
Partner
Partner

Try:

Above(

sum({$<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'} >} EAD_ATUAL)/1000000

)

 

per analogy:Capture.PNG

 

View solution in original post

antoniodneto
Creator II
Creator II
Author

Hei Omar it worked.

One question, Can I insert one line with the variance of month - previous month?

OmarBenSalem
Partner
Partner

Use the "combined chart"

Capture.PNG

add a 3rd measure : 

(

sum({$<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'} >} EAD_ATUAL)/1000000

-

Above(

sum({$<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'} >} EAD_ATUAL)/1000000

)

)

/

Above(

sum({$<STAGE_IFRS9_FINAL_X={'Stage 1'},Carteira_IFRS_ATUAL={'EMPRESAS_1','EMPRESAS_2','EMPRESAS_3'},MOTIVO=-{'Fora Escopo Anterior','Saiu do Escopo','Se mantém fora do Escopo','Fora Escopo Atual'} >} EAD_ATUAL)/1000000

)

put it as a line (second axis) :

Capture.PNG

 

Result:

Capture.PNG

 

antoniodneto
Creator II
Creator II
Author

Hi I did, but look how it plotted.

 

 

 

OmarBenSalem
Partner
Partner

Under the x-axis, uncheck continous axis.