Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
sathishkumar_go
Partner - Specialist
Partner - Specialist

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
swuehl
MVP
MVP

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]))

sathishkumar_go
Partner - Specialist
Partner - Specialist

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

Not applicable
Author

Thank you Sathish G, it works perfect.

My best regards.

Not applicable
Author

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