# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

New Contributor III

## What If Analysis - Simple query (I think)

Hi

I am sure this is a simple query for most, but I can't find the answer or any good qvw examples.

I have some data that tells me 'total hours worked' & 'total cost' over a period.

I want to create a slider that allows me allows me to change the number of hours, which then gives me a 'what if' on cost? i.e.  How many hours less need to be worked to be within budget?

How do I do this?

Apologies if this is a really simple query, but I just can't find a good example.

Thanks

Phil

Tags (3)
4 Replies

## Re: What If Analysis - Simple query (I think)

Valued Contributor

## Re: What If Analysis - Simple query (I think)

Hi Phil,

Thinking through the logic, you'd want to create a variable (call it vHours) and create a slider to manage this variable. You can either enter logical minimum/maximum values for the slider, or create a range based on your data...something like Sum([Total Hours Worked]) * X where X is your stretch factor.

I assume you'd want a "cost per hour", so create an expression either in a text box (if this is aggregated data) or as an expression in a straight table chart (where project or person is your dimension for example) that is [total cost]/[total hours worked].

If you then multiply this by your variable you'll see the new "total" cost change depending on the number of hours worked. You can then match it to whatever budgets you have.

Happy to mock this up if that doesn't make sense!

New Contributor III

## Re: What If Analysis - Simple query (I think)

Plzz help me... if any1 know about the what-if-queries... how does it work in a query...

New Contributor III

## Re: What If Analysis - Simple query (I think)

Help me!! If any1 knows about whatif query works in a given query.. why do you used it???