Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
ankit_tikoo
Contributor II
Contributor II

Relative percentage calculation issue

Hi Guys,

I have a problem statement for all. I am from payment industry. Let me explain my problem

Day  Failure/success reason    Txn_Count

1        No funds                           10

1       Cancelled                           20

1        Not approved  by bank      30

1        Successful                         40

Total                                            100

I have put a condition in the expression(Txn_Count) formula that Status='failed' to get below:

Day  Failure/success reason   Txn_count

1        No funds                           10

1       Cancelled                           20

1        Not approved                     30

I want count to be a relative percent i.e 10% for no funds, 20% for cancelled and 30% for not approved. This percent should be calculated with denominator 100 not 60

Also, This is for only on day. If there are many days and I select No funds failure reason, it should show relative share for all individual days.


1   No Funds   40%

2   No Funds  20%

3   No Funds  10%


Right now its showing 100% for all days. Can anyone help here

1 Solution

Accepted Solutions
sunny_talwar

I guess it might have gotten lost in my post... but you cannot have 'Relative' option checked... Try removing that

Capture.PNG

View solution in original post

21 Replies
sunny_talwar

May be try this

Count({<Status = {'failed'}>}Txn)/Count(TOTAL Txn)

ankit_tikoo
Contributor II
Contributor II
Author

Did not work buddy...still showing 100% for some and 0% for others.

First need is to eliminate the successful info from the table. For that, I have put the expression formula

sum(if(Status='failed',Txn_count,0)

Now the next problem is to find relative percent of failures out of total txns

i.e  Status          Reason                Txn_Count    Day

      Failed          No funds                  10%        1

      Failed          Cancelled                20%        1

      Failed          Not approved          30%        1

      Success        Successful              40%        1

      Failed          No funds                  20%        2

      Failed          Cancelled                  20%        2

      Failed          Not approved            10%        2

      Success        Successful              50%        2

I want the below

i.e  Status          Reason                Txn_Count    Day

      Failed          No funds                  10%           1

      Failed          Cancelled                20%           1

      Failed          Not approved          30%          1

      Failed          No funds                  20%          2

      Failed          Cancelled                  20%         2

      Failed          Not approved            10%         2

I want the above table in bold. Thanks!!

sunny_talwar

Would you be able to share a sample where this did not work?

Count({<Status = {'failed'}>}Txn)/Count(TOTAL Txn)

Did you remove the relative option?

ankit_tikoo
Contributor II
Contributor II
Author

Hi Sharing a file. The problem here is that individual failure percentages should be calculated out of total txns but here that is not happening and I am only getting failure % of an individual failure reason out of total failures.

It should be Failure/total txns rather than failure/total fails

Attaching a file to show you the issue

ankit_tikoo
Contributor II
Contributor II
Author

Relative is still selected

sunny_talwar

Does any one of these look like what you wanted?

Capture.PNG

pablolabbe
Luminary Alumni
Luminary Alumni

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others

ankit_tikoo
Contributor II
Contributor II
Author

No all the percentages are same in the above table

For e.g it should have been like below for day 1

Day                      Comment              TXn_count

1                         Risk failure                 5%

1                   Failed at bank end           10%

1                      Risk Failure                   15%

I had taken total of 100 txns out of which successful were 70,failed were 30.

So basically, I want fail% of individual comments/failure reasons out of total txns which was 100 in this example.

Tried many things but still not getting it.

sunny_talwar

Try this

Sum({<Status = {'Failed'}>}Txn_count)/Sum(TOTAL <Day> Txn_count)