Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
pgalvezt
Specialist
Specialist

Substract by

Hello,

I have the following formula:

(sum({<Cuenta={'01020304'}>}Monto_Pesos) /Valor_Factor) - (sum({<Doc={'AM130311000005','AM130311000006'}>}Monto) /Valor_Factor).

There are many more "AM"

In the pivot Appear.

Doc     Monto

A          5000

B          10000

So on

AM130311000005    -90000

AM130311000006    -98777

I would like if its possible subtract all documents beginning with "AL" (Because there are many "AL"). This negative value is shown in the chart but would not appear in the pivot. Only in the final result.

Thanks!

29 Replies
iktrayanov
Creator III
Creator III

You can suppress nulls and redefine your totals using dimensionality().

pgalvezt
Specialist
Specialist
Author

Can you explain that with more details please,

Thanks!

iktrayanov
Creator III
Creator III

Take a look at this example.

I am hiding the row for A but my total still includes all values.

Hope that helps.

pgalvezt
Specialist
Specialist
Author

Hi Ivan,

Thank you for your reply:

QlikView Gives me a null value this is my formula:

If(Dimensionality() = 0, Sum(Total sum({<Cuenta={'01020304'}>}Monto*-1 /Valor_Factor)),sum({<Cuenta={'01020304'}>}Monto*-1 /Valor_Factor))

What do I doing Wrong?

Dimensinality expression gives me 2.

Thanks!

iktrayanov
Creator III
Creator III

Can I see a snapshot?

pgalvezt
Specialist
Specialist
Author

Hi Ivan,

I put 2 snapshot one of them is with Dimensinality.

Thanks!

nizamsha
Specialist II
Specialist II

=(sum({$<category={"*"}>}Amount)/Count({$<category={"ID1","ID2"}>}DISTINCT Orders))-

(sum({$<category={"*"}>}Amount)/Count({$-<category={"ID1","ID2"}>}DISTINCT Orders))

it will work change according to ur formula

pgalvezt
Specialist
Specialist
Author

Hi Nizam,

=(sum({$<Cuenta={"01020304"}>}Monto)/Count({$<Cuenta={"01020304"}>}DISTINCT Monto))-

(sum({$<Cuenta={"01020304"}>}Monto)/Count({$-<Cuenta={"01020304"}>}DISTINCT Monto))

Gives Null Values,

iktrayanov
Creator III
Creator III

I think you have extra Sum() in your expression

Try this

If(Dimensionality() = 0, Sum(Total{<Cuenta={'01020304'}>}Monto*-1 /Valor_Factor),sum({<Cuenta={'01020304'}>}Monto*-1 /Valor_Factor))

If this doesn't work I wold test each expression separately first and then put into If statement.

pgalvezt
Specialist
Specialist
Author

Hello Ivan,

Is Ok this formula?

if (Dimensionality() = 0,

Sum(total sum({<Cuenta={'31010101'}>}Monto*-1 /Valor_Factor),sum(sum({<Cuenta={'31010101'}>}Monto*-1) /Valor_Factor)))

This gave me an error!

I dont know if Sum(total with Set analysis works of the same way that Sum(Total Value) like your formula:

if (Dimensionality() = 0,

Sum(total Value),sum(Value))

QlikView don't recognize the total as a field. Could be that?

Thanks!