# New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
New Contributor

## Calculate Percentage of a group

Hi,

I am new with QlikView and I like to have a linechart with percentage.

My definition: if(POSITION = 1,count(Distinct PORDER_ID))/if(POSITION = 1,count(TOTAL Distinct PORDER_ID))

The Problem is, that I now have to percentage of the whole time.

I Like to have the percentage of each timeframe and the problem is that I use a group to change the timeframe. Is it possible to use a group? Labels (2)

• ### Percentages

2 Replies
Valued Contributor

## Re: Calculate Percentage of a group

Hello Svenja,

yes it's Possible.
this Expression should work (even while changing Group)
count(Distinct if(POSITION = 1,PORDER_ID)) / count(TOTAL if(POSITION=1,PORDER_ID))

if you want to do Special things with your current Group selection:
1) Create a variable vGroupTest: =GetCurrentField(GroupName)
2) then use that Expression to Aggregate on the current selected Group Dimension
count(Distinct if(POSITION = 1,PORDER_ID)) / count(TOTAL <\$(vGroupTest)> if(POSITION=1,PORDER_ID))
3) you can also use aggr( Expression, \$(vGroupTest)) instead

regards
tim MVP

## Re: Calculate Percentage of a group

May be something like this

```Count(DISTINCT {<POSITION = {1}>} PORDER_ID)/
Count(DISTINCT {<POSITION = {1}>} TOTAL <\$(='[' & GetCurrentField([GroupName]) & ']')> PORDER_ID)```

Here replace GroupName with your x axis cycle group name