9 Replies Latest reply: Nov 8, 2011 4:44 PM by Swarup Malli

# Expression to get the SUM on the First Month...I'm very close

Hi all,

I'm trying to get an expression to obtain the next:  For each InsumoKey (product) the SUM(TotalPago) in the First Month (MesAnio)

I think I'm very close with this expressión:

```SUM ( {\$<MesAnio = {\$(=min(MesAnio))} > } TOTAL <InsumoKey> TotalPago )
```

But, obviously, \$<MesAnio = {\$(=min(MesAnio)) is returning the min(MesAnio) for the whole selection, and I need some expression to get the min(MesAnio) for each InsumoKey.

You can see this expression in the example below, in the chart column [Total_FirstMonth], and as you can see, it isn't working for the InsumoKey = "ACH-030" I think because their min(MesAnio) is 201104.

Hope can you help me.

Best regards,

Roberto

• ###### Expression to get the SUM on the First Month...I'm very close

I didnt understand very well what you need. Could you post an excel with an example?

• ###### Re: Expression to get the SUM on the First Month...I'm very close

sure,

In the column Total_FirstMonth (F) what I need is the same value from column C which is the SUM(TotalPago) for the first MesAnio for each InsumoKey.

In the QV example that column has the correct value except for the two rows where InsumoKey = "ACH-030"

In the excel example I've yellow colored this two rows.

thank you.

Roberto

• ###### Expression to get the SUM on the First Month...I'm very close

Hi Roberto,

Try with this: SUM ( {\$<MesAnio = {"=sum(TotalPago)>0"} > } TotalPago )

Hope this helps,

Regards!

• ###### Expression to get the SUM on the First Month...I'm very close

Thank you Gabriela, but I think you didn't understand my problem.

did you see my excel example...?

that's what I want to get.

thank you

Roberto

• ###### Re: Expression to get the SUM on the First Month...I'm very close

Hi Roberto,

Here is a solution

Hope this helps

Regards!

• ###### Expression to get the SUM on the First Month...I'm very close

Thank you Gabriela, but it doesn't work if a change order on MesAnio column.

• ###### Re: Expression to get the SUM on the First Month...I'm very close

Gabriela,

That was a excellent expression u wrote,

What is the Above function used for ?

Regards

Swarup

• ###### Expression to get the SUM on the First Month...I'm very close

Hi Swarup,

Above(expr) evaluates the expression with the dimension values from the row above the current, you can find more info and examples in the QlikView help

Regards!

• ###### Re: Expression to get the SUM on the First Month...I'm very close

Thank u , Gabriella

Regards

Swarup