Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
harson
Contributor III
Contributor III

Calculation based on dimension selected

Hello Community,

I have a problem on QlikView at this time,

I have to calculate the working times (DT) to suit the selected pause types.

First I have to create check boxes for my different types of pause, like this:

      Avec Pause Administrative

       Avec Pause toilette

      Avec Pause déjeuner

       Avec Pause 15min

The formula for working time (TD) is : DT = [Work_duration] – [pause_duration] with pause_duration is the value of  pause_duration for the checked boxes.

For example :

            In 03/04/2017

-          If I check « Avec Pause Adminitrative »

=> DT = [Work_duration]-[pause_duration] for the pause_code= PA

ð  DT = 158 :25 :00 – 04 :30 :00

-          If I check  « Avec Pause Adminitrative », « Avec Pause toilette »

=> DT = [Work_duration]-[pause_duration] for the pause_code = PA et PT

ð  DT = 158 :25 :00 – (04 :30 :00 + 04 :20 :00)

-          And if I don’t check anything on the ticked boxes DT= [Work_duration]

Any idea ?

Thanks in advance.

This is my  data :

Pause :
LOAD * INLINE [
     Date, pause_duration, pause_code
     03/04/2017, 04:30:00, PA
     04/04/2017, 03:15:00, PA
     05/04/2017, 04:48:00, PA
     06/04/2017, 03:21:00, PA
     07/04/2017, 03:54:00, PA
     03/04/2017, 04:20:00, PT
     04/04/2017, 04:15:00, PT
     05/04/2017, 04:48:00, PT
     06/04/2017, 04:21:00, PT
     07/04/2017, 20:15:00, PT
     03/04/2017, 19:15:00, PD
     04/04/2017, 19:53:00, PD
     05/04/2017, 18:04:00, PD
     06/04/2017, 19:53:00, PD
     07/04/2017, 19:25:00, PD
     03/04/2017, 05:15:00, P15
     04/04/2017, 04:52:00, P15
     05/04/2017, 03:00:00, P15
     06/04/2017, 04:29:00, P15
     07/04/2017, 05:25:00, P15
]
;

Pause_description :
LOAD * INLINE [
     pause_code, pause_description
     PA, Pause Administrative
     PT, Pause toilette
     PD, Pause déjeuner
     P15, Pause 15min
]
;


Work :
LOAD * INLINE [
     Date, Work_duration
     03/04/2017, 158:25:00
     04/04/2017, 160:12:00
     05/04/2017, 159:12:00
     06/04/2017, 160:03:00
     07/04/2017, 159:32:00
]
;
 

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Is this what you're after? check the app

257377.PNG

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

View solution in original post

12 Replies
hariprasadqv
Creator III
Creator III

Hi Tsiry,

you can implement this scenario in two ways

1.Write three different expressions and  Use conditional enabling

2.Use Pick

Thanks

harson
Contributor III
Contributor III
Author

Could you be more specific, or give an example please. I'm new to QlikView.

hariprasadqv
Creator III
Creator III

Under expression tab of the chart/table you can find Conditional Check box.

Check the box and it will enable an expression field in that write following

getselectedvalue(pause_description)='Avec Pause Adminitrative'

and in the expression write the logic in expression field

[Work_duration]-[pause_duration]

the above expression will work on selection of 'Avec Pause Adminitrative'

use the same for the rest of the expressions

harson
Contributor III
Contributor III
Author

With this 4 dimensions, there are 13 possible combinations, so I have to create 13 different expressions and conditions.

hariprasadqv
Creator III
Creator III

Not exactly.

If am understanding right, you have to write only 3 conditions

In the 1st expression condition use GetFieldSelections(pause_description)='Avec Pause Adminitrative',getselectedvalue(pause_description)='Avec Pause Adminitrative'

In the 2nd expression you can enable condition with  implement with GetFieldSelections() and Subfield() function

and the 3rd use getselectedcount(pause_description)

(If nothing is selected getselectedcount()  will return '0'. In Qlikview '0' is false other than zero is true. But ~0=-1)

harson
Contributor III
Contributor III
Author

Thank you for your reply,

But, maybe I have wrongly expressed my problem

I'll try to explain it again.

I have to automate the result of my DT according to the selected dimensions

With DT = [Work_duration] - Sum[pause_duration]

If "Avec Pause Administrative", "Avec Pause toilette" is cheked, DT=[Work_duration] - Sum({<pause_code={'PA','PT'}>}[pause_duration])

OR If "Avec Pause Administrative", "Avec Pause toilette",'Avec Pause déjeuner' is cheked, DT=[Work_duration] - Sum({<pause_code={'PA','PT','PD'}>}[pause_duration])

OR If "Avec Pause Administrative" is cheked, DT=[Work_duration] - Sum({<pause_code={'PA'}>}[pause_duration])

And so on...

vinieme12
Champion III
Champion III

Is this what you're after? check the app

257377.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
parul_mehta
Partner - Creator
Partner - Creator

You may want to try this

parul_mehta
Partner - Creator
Partner - Creator

Also is your selection only dependent on Pause_description?

Or Date as well ? and any other field also ?