Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
Not applicable

Get Total Sum from conditional SUM

Hello there:

I have an Straight Table and I need to replicate sum Totals for each month selected, something like when May is selected:

Totales.png

In my Qlikview file shows the information like:

Qlik Totales.png

When I hide the Column AñoNombreMes, the result is different from the sum of values

Here is my expression:

=if

(Only ({<MesT=,Mes>}Codigo_IndicadorT)='PROFIT' ,

Sum({<EscenarioT={'REAL'},AñoT={'$(vMaxAño)'},Mes_Num={'>=1 <=$(vMaxMesNum)'},Mes=,MesT=,Total_MedidaT={'=not isnull(Total_MedidaT)'}>} Datos)

*

Count({<Año={'$(vMaxAño)'},Mes=,MesT>} DISTINCT(FechaCont))

)

I Wonder if it is possible to get the Total sum from the conditional SUM or change the expression in order to get the correct sum of values.

Thanks in advance.

My best regards.

1 Solution

Accepted Solutions
Partner
Partner

Re: Get Total Sum from conditional SUM

HI,

Try This

=sum({<MesT=,Mes, Codigo_IndicadorT={'PROFIT'}, EscenarioT={'REAL'},AñoT={'$(vMaxAño)'},Mes_Num={'>=1 <=$(vMaxMesNum)'},Mes=,MesT=,Total_MedidaT={'=not isnull(Total_MedidaT)'}>}
aggr(
Sum({<MesT=,Mes, Codigo_IndicadorT={'PROFIT'}, EscenarioT={'REAL'},AñoT={'$(vMaxAño)'},Mes_Num={'>=1 <=$(vMaxMesNum)'},Mes=,MesT=,Total_MedidaT={'=not isnull(Total_MedidaT)'}>} Datos)
*
Count({<MesT=,Mes, Codigo_IndicadorT={'PROFIT'}, Año={'$(vMaxAño)'},Mes=,MesT>} DISTINCT(FechaCont))
,
[AñoNombreMes])
)

-Sathish

View solution in original post

4 Replies
MVP
MVP

Re: Get Total Sum from conditional SUM

Maybe using advanced aggregation, something like

=Sum({<EscenarioT={'REAL'},AñoT={'$(vMaxAño)'},Mes_Num={'>=1 <=$(vMaxMesNum)'},Mes=,MesT=,Total_MedidaT={'=not isnull(Total_MedidaT)'}>}
Aggr(
if
(Only ({<MesT=,Mes>}Codigo_IndicadorT)='PROFIT' ,
//Aggr(
Sum({<EscenarioT={'REAL'},AñoT={'$(vMaxAño)'},Mes_Num={'>=1 <=$(vMaxMesNum)'},Mes=,MesT=,Total_MedidaT={'=not isnull(Total_MedidaT)'}>} Datos)
*
Count({<Año={'$(vMaxAño)'},Mes=,MesT>} DISTINCT(FechaCont))
//,EscenarioT, AñoNombreMes ,AreaT ,Descripcion_IndicadorT)
)
,[AñoNombreMes]))

Partner
Partner

Re: Get Total Sum from conditional SUM

HI,

Try This

=sum({<MesT=,Mes, Codigo_IndicadorT={'PROFIT'}, EscenarioT={'REAL'},AñoT={'$(vMaxAño)'},Mes_Num={'>=1 <=$(vMaxMesNum)'},Mes=,MesT=,Total_MedidaT={'=not isnull(Total_MedidaT)'}>}
aggr(
Sum({<MesT=,Mes, Codigo_IndicadorT={'PROFIT'}, EscenarioT={'REAL'},AñoT={'$(vMaxAño)'},Mes_Num={'>=1 <=$(vMaxMesNum)'},Mes=,MesT=,Total_MedidaT={'=not isnull(Total_MedidaT)'}>} Datos)
*
Count({<MesT=,Mes, Codigo_IndicadorT={'PROFIT'}, Año={'$(vMaxAño)'},Mes=,MesT>} DISTINCT(FechaCont))
,
[AñoNombreMes])
)

-Sathish

View solution in original post

Not applicable

Re: Get Total Sum from conditional SUM

Thank you Sathish G, it works perfect.

My best regards.

Not applicable

Re: Get Total Sum from conditional SUM

Thank you for you time swuehl, it works, nevertheless when I unmark PROFIT the column doesn't show values.