Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
pageomet
Contributor
Contributor

Calculated Dimension

Hi;

I'm trying to create a calculation dimension based on a condition.  My formula isn't working:

=aggr(if(sum({<[In Violation] = {'1'}>}[Units In Violation],1,0), [Location Type]))

I'm trying to calculation the number of units in violation for each location type.   Any help will be appreciated.   Thanks.

8 Replies
trdandamudi
Master II
Master II

Is it possible to share a small sample..



sunny_talwar

How do you want your dimension to look like?

settu_periasamy
Master III
Master III

Not sure.. but seems to be condition is missing with if ..

Try like

=aggr(if(sum({<[In Violation] = {'1'}>}[Units In Violation])>0,1,0), [Location Type])

vinieme12
Champion III
Champion III

You want to calculate the number of units in violation, then you should be adding an expression, not a calculated dimension.


Use this Expression:

SUM({<[In Violation] = {'1'}>}[Units In Violation])


Or this Dimension

AGGR(SUM({<[In Violation] = {'1'}>}[Units In Violation]),[Location Type])

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
pageomet
Contributor
Contributor
Author

Thanks;

This was very helpful.

pageomet
Contributor
Contributor
Author

Thanks Vineeth Pujari;

This formula worked. 

Also can you help me with another formula?   I'm trying to get the total sum in the calculated dimension.  See table below:


                    Days Complete       Count VIN

                         < 5                              3

                          5 - 10                          5

                           > 10                           1

         Total                                             9


I used the following expression and getting invalid dimension:

aggr(if([Days Complete] < 5 count([VINS]),

if([Days Complete] >= 5 and [Days Complete] <= 10 count([VINS]),

if([Days Complete] > 10 Count([VINS]))))),[Location])

Thanks,


                        

vinieme12
Champion III
Champion III

can you post sample data to demonstrate?

Your expression and dimension should be something as below

Dimension:

if([Days Complete] <5,'<5',

if([Days Complete] >= 5 and [Days Complete] <= 10,'5-10',

if([Days Complete] >10 ,'>10')))


Expression

SUM(VINS])

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
oknotsen
Master III
Master III

If your question is now answered, please flag the Correct Answer (via the big "Correct Answer" button near every post) and Helpful Answers (found under the Actions menu under every post).

If not, please make clear what part of this topic you still need help with .

May you live in interesting times!