Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculation filtering some values of a dimension

Hello:

I have a dimension called "Centro" (Values: ND1, ND2, ND3, ND4, NR1, NR2, NR3, NR4, NF1, NF).

I want to calculate the measure "%Scrap" as "Sum(CHTQuantity)/Sum(PQuantity)*100" but only with some values from the dimensión "Centro" (NR1,NR2,NR3, NR4, NF1 and NF). How can define the formula?

Thank you in advance

1 Solution

Accepted Solutions
mkelemen
Creator III
Creator III

Hi,

use set analysis

Sum({<Centro = {'NR1', ''NR2', ...}>} CHTQuantity)

You can find more info here A Primer on Set Analysis

BR,

  Matus

View solution in original post

8 Replies
mkelemen
Creator III
Creator III

Hi,

use set analysis

Sum({<Centro = {'NR1', ''NR2', ...}>} CHTQuantity)

You can find more info here A Primer on Set Analysis

BR,

  Matus

Not applicable
Author

Hi Eugenio,

Can you share sample data with expected to do the same.

Regards,

Arun Kumar A

kkkumar82
Specialist III
Specialist III

As suggested by others,

Use the measure as


Sum({<Centro = {'NR1','NR2','NR3', 'NR4', 'NF1',' NF'}>}CHTQuantity)

/

Sum({<Centro = {'NR1','NR2','NR3', 'NR4', 'NF1',' NF'}>}PQuantity)*100


or you can also write a calculated dimension as


if(Match(Centro,'NR1','NR2','NR3', 'NR4', 'NF1',' NF'), Centro)

and your expression as it is.


Dont forget to check " Supress when value in Null' in Dimensions tab for Centro





Not applicable
Author

The slide shows several graphics regarding full factory but in case to the ratio %Scrap must be shows only the agregate value for specific Production centers.
The list of production center is over 100 and for scrap purposes should be arround 45.
Depending user selection if not specific centers are selected , ratio must be "Blank" . That´s working but if I select all the specific centers and after I deselect some of theirs, the value does not changed.
I am able to show the "%scrap" value but not to do it variable as a rest of KPI´s on the slide.

For example I am using the following formula:
Sum({<Centro = {'NR1','NR2','NR3', 'NR4', 'NF1',' NF'}>}CHTQuantity)/
Sum({<Centro = {'NR1','NR2','NR3', 'NR4', 'NF1',' NF'}>}PQuantity)*100

If I deselect NR1 and RR2 the value does not change.
How can I do?

Do you need more detail to help me?
Thank you

Not applicable
Author

What is the filter you are selecting, are you selecting "Centro", if so, then the expression doesn't change as you have restricted the expression for some values but if you select other fields which are associated with Centro then the expression value should change.

Not applicable
Author

Thank you Kumar:

I am using this formula and Now is working.

Sum({$<Centro={"NR1","NR2","NR3","NR4","NF1","NF"}>}CHTQuantity)/Sum({$<Centro={"NR1","NR2","NR3","NR4","NF1","NF"}>}PQuantity)*100

Not applicable
Author

Super , close this thread , by making a thread answer as correct , so that it will be helpful to others.

Not applicable
Author

Thank you Matus