# New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Contributor

## set analysis

i am new in qv.

i want to do set analysis operation.

1)i have done database cloud.

2)in the cloud actualamount and budgetamount are present.

3)i want to show budget cost,actual cost,margin(budget/actual -1) for the seletd year as well as previous year in the same bar graph.

1 Solution

Accepted Solutions MVP

## Re: set analysis

Hi,

You need to create the variable with values as below

vT should have value of =Max(YearFieldName) which gets the selected year

vT1 should have value of =Max(YearFieldName)-1 which gets the previous year

YearFieldName should be dimension.

Expression for the budget cost for current year and previous year

=Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} budgetCost) for budget cost

=Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} actualCost) for actual cost

=Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} budgetCost)/Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} actualCost) - 1 for margin

8 Replies MVP

## Re: set analysis

Hi

Use like this

=Sum({<Year = {\$(vT)}>}budget cost) Where vT = max(Year)

=Sum({<Year = {\$(vT1)}>}budget cost) Where vT1 = max(Year)-1

Hope it helps

Contributor

## Re: set analysis

i have followed your instruction-

please let me know whether is the following steps is ok or not

1)created two variables a)vT(for current year)  b)vT1(prev year),

2)created two more variables two holding this

=Sum({<Year = {\$(vT)}>}budget cost) Where vT = max(Year)

=Sum({<Year = {\$(vT1)}>}budget cost) Where vT1 = max(Year)-1

3)from the barchart select those variable name. MVP

## Re: set analysis

Hi

Can you explain third point? Not sure, what is that?

Use no dimension or Year as dimension

Contributor

## Re: set analysis

i am talking about expression.

should i map all those variable into the expression? MVP

## Re: set analysis

Hi

Yes, Use both expression ..

1st: =Sum({<Year = {\$(vT)}>}budget cost)

2nd: =Sum({<Year = {\$(vT1)}>}budget cost)

Hope it helps MVP

## Re: set analysis

Hi,

You need to create the variable with values as below

vT should have value of =Max(YearFieldName) which gets the selected year

vT1 should have value of =Max(YearFieldName)-1 which gets the previous year

YearFieldName should be dimension.

Expression for the budget cost for current year and previous year

=Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} budgetCost) for budget cost

=Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} actualCost) for actual cost

=Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} budgetCost)/Sum({<YearFieldName={\$(=vT),\$(=vT1)}>} actualCost) - 1 for margin

Contributor

thanks

Contributor

## Re: set analysis

thanks

Community Browser