Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mromrod22
Partner - Contributor III
Partner - Contributor III

Static expressions

Hi community,

I need modify a expression of bar char, but not look the path.

I have this char, that works with this expression:

1.PNG

count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'Rev0'}>} SOLI_ID_SOLICITUD) +

  count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'*'} - {'Rev0'}, ESSO_ID_ESTADO_BLOQ={1}>} SOLI_ID_SOLICITUD)

And this is my problem:

The results depending of filters, are these:

2.PNG

The numbers in red are that I need change. The results I want are these:

3.PNG

Explain with a example:

Filter -> "Rev0,Rev1,Rev2"

Static values for Rev0 in Ene and Feb, static values for Rev1 in Mar and Abr, and since May to Dic., values of Rev2.

Conclusion: static values for Revs checked and rest of values of the last Rev checked.

Any idea?

Thanks.

1 Solution

Accepted Solutions
sunny_talwar

Since I don't have access to your data source, I will give your something which may or may not work.... but at least we can try. Add this table to your script

SortSelectorAnual:

LOAD DISTINCT

  [Selector Anual],

  RowNo() as Sort

Resident SelectorAnual

Order By [Selector Anual];

and change your expression to this:

If(GetSelectedCount([Selector Anual]) = 1 and Len(Trim([Selector Anual])) > 4,

count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'Rev0'}>} SOLI_ID_SOLICITUD) +

  count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'*'} - {'Rev0'}, ESSO_ID_ESTADO_BLOQ={1}>} SOLI_ID_SOLICITUD),

If(Len(Trim([Selector Anual])) = 4,

Only({<[Selector Anual]>}Aggr(If(RowNo() = NoOfRows(),

count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'Rev0'}, [Selector Anual]>} SOLI_ID_SOLICITUD) +

  count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'*'} - {'Rev0'}, ESSO_ID_ESTADO_BLOQ={1}, [Selector Anual]>} SOLI_ID_SOLICITUD)), Mes, Sort)),

Only(Aggr(If(RowNo() = NoOfRows(),

count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'Rev0'}>} SOLI_ID_SOLICITUD) +

  count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'*'} - {'Rev0'}, ESSO_ID_ESTADO_BLOQ={1}>} SOLI_ID_SOLICITUD)), Mes, Sort))))

Again, I don't know if this will work or not, but worth giving a shot.

Best,

Sunny

View solution in original post

20 Replies
mromrod22
Partner - Contributor III
Partner - Contributor III
Author

Forgot explain each Rev corresponds to two months, in order: Rev0 (Ene, Feb), Rev1 (Mar, Abr).........

Thanks

mromrod22
Partner - Contributor III
Partner - Contributor III
Author

Also forgot show the dates that I have:

4.PNG

Thanks

vinieme12
Champion III
Champion III

please post a sample, it'll be easier to assist

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
mromrod22
Partner - Contributor III
Partner - Contributor III
Author

Create a sample is difiicult (need three tables, many data...) , and can´t share the .qw, confidentially policy with client. Sorry.

mromrod22
Partner - Contributor III
Partner - Contributor III
Author

Ok, share the .qw scrambled and reduced.

Thanks. Wait your help.

sunny_talwar

Try this expression:

If(GetSelectedCount([Selector Anual]) = 1 and Len(Trim([Selector Anual])) > 4,

count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'Rev0'}>} SOLI_ID_SOLICITUD) +

  count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'*'} - {'Rev0'}, ESSO_ID_ESTADO_BLOQ={1}>} SOLI_ID_SOLICITUD),

If(GetSelectedCount([Selector Anual]) = 2,

Only(Aggr(If(RowNo() = NoOfRows(),

count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'Rev0'}>} SOLI_ID_SOLICITUD) +

  count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'*'} - {'Rev0'}, ESSO_ID_ESTADO_BLOQ={1}>} SOLI_ID_SOLICITUD)), Mes, ([Selector Anual], (TEXT)))),

Only({<[Selector Anual]>}Aggr(If(RowNo() = NoOfRows(),

count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'Rev0'}, [Selector Anual]>} SOLI_ID_SOLICITUD) +

  count(DISTINCT {<[Tipo Fecha]={$(vTipoFecha)}, Foto={'Publicación anual'}, [Revisión plan anual] = {'*'} - {'Rev0'}, ESSO_ID_ESTADO_BLOQ={1}, [Selector Anual]>} SOLI_ID_SOLICITUD)), Mes, ([Selector Anual], (TEXT))))))

This will only work if you have QV12, if you don't then you have to sort the Selector Anual field in the script for this to work properly. I can help you with that if you don't have QV12, but if you do then check out the attachment

mromrod22
Partner - Contributor III
Partner - Contributor III
Author

Hi,

My version is 11.20. Sorry, I´m beginner in Qlik, don´t know that you say with "sort the Selector Anual field in the script".

Your expression show errors and not works:

1.PNG

I proved in local with Qlik 12, and not show errors in expression, and works, but not completely good.

Example:

4.PNG

2.PNG

This expression is difficult for a beginner -_-''

Thanks.

sunny_talwar

That is fixed, but there might be another combination which might not fixed. Since there are so many combinations, it tends to get tricky. But since you have a better idea, can you check....

Capture.PNG