# Qlik Sense App Development

Announcements
New Contributor III

## Percentage Calculation in Cohort Analysis

Hello,

I built a Cohort Analysis Table like the image below. But I cant figure out, how I am able to calculate the percentage values of each column and row in Comparison to the first value in the row.

E.G.: In the 'Juni-2017' column I want the Percentage difference between 2215 and 2159 which is roughly 97%. In the row below I want 100% because 81 is 100% of itself.

1 Solution

Accepted Solutions
New Contributor III

## Re: Percentage Calculation in Cohort Analysis

I got it to work with :

left([Member], 1000) / count(distinct total <YEARMONTH>{<isMember={1}>}DEALER_ID)

YEARMONTH is the upper Dimension. The 1000 is just way overgrowth to make sure, it takes all digits in the field.

Sadly the same doesnt work for my second Pivot, although its exactly the same just with Fees instead of Members. E:G.:

Fee is: Sum({isMember={1}}DBD_LISTING_FEES)

and % therefore should be: left([Listing Fee], 1000)  / Sum(total <YEARMONTH>{isMember={1}}DBD_LISTING_FEES)

But this doesnt work, dont know why though.

5 Replies
MVP

## Re: Percentage Calculation in Cohort Analysis

What is your expression for Member here?

New Contributor III

## Re: Percentage Calculation in Cohort Analysis

Count({<isMember = {1}>}DEALER_ID)

MVP

## Re: Percentage Calculation in Cohort Analysis

May be this

Alt(
Count({<isMember = {1}>}DEALER_ID)/Before(Count({<isMember = {1}>}DEALER_ID))
, 1)
New Contributor III

## Re: Percentage Calculation in Cohort Analysis

alt ( ...

Before(Count({<isMember = {1}>}DEALER_ID))

)

just returns the value, one column before and not the first in the row.

New Contributor III

## Re: Percentage Calculation in Cohort Analysis

I got it to work with :

left([Member], 1000) / count(distinct total <YEARMONTH>{<isMember={1}>}DEALER_ID)

YEARMONTH is the upper Dimension. The 1000 is just way overgrowth to make sure, it takes all digits in the field.

Sadly the same doesnt work for my second Pivot, although its exactly the same just with Fees instead of Members. E:G.:

Fee is: Sum({isMember={1}}DBD_LISTING_FEES)

and % therefore should be: left([Listing Fee], 1000)  / Sum(total <YEARMONTH>{isMember={1}}DBD_LISTING_FEES)

But this doesnt work, dont know why though.