Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rwb139
Creator
Creator

Pivot Table Percentages

Hi Qlik Community,

I am trying to create a pivot table that has the following layout where I have a list of our partners on as rows, and as subdimensions of those it would have what properties they have invested in, for how much, and what percentage ownership it is. It works when showing only one property. For example if Property 1 costs $244,134.04 and partner 1 owned all of that amount it shows up as % ownership = 100%. However, when I add more properties, it instead takes the total amount of all the properties selected and throws off the calculation. Hoping someone can help figure out this issue. I have a picture of the calculation that I am using for the % ownership as well.

rwb139_1-1610747327068.pngrwb139_2-1610747440922.png

 

rwb139_3-1610747458781.png

 

1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

Not sure if I have the field names for Property and Owner correct, but I think this is what need:

sum({<gl_account_type={'Capital'}>} Total <[Property Name],Owner>
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)
/
sum({<gl_account_type={'Capital'}>} Total <[Property Name]>
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)

View solution in original post

5 Replies
GaryGiles
Specialist
Specialist

Not sure if I have the field names for Property and Owner correct, but I think this is what need:

sum({<gl_account_type={'Capital'}>} Total <[Property Name],Owner>
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)
/
sum({<gl_account_type={'Capital'}>} Total <[Property Name]>
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)

rwb139
Creator
Creator
Author

Hi @GaryGiles 

Thanks for your help! I do have a quick question as I am pretty new to this: should I make a calculated field named "Owner" that is: if(gl_account_type='Capital',if(WildMatch(gl_account_name, '*Initial*'),gl_account_name))? Because right now I don't have an "Owner" field and when I use that formula in it's place I get an error. Thanks again for your time!

GaryGiles
Specialist
Specialist

Yes, you will need to create an owner field in your load script since you can't reference a formula using Total <fieldname>.  It needs to be a field.  Hope this helps.

rwb139
Creator
Creator
Author

@GaryGiles 

Thanks for your help. I've been working on this today to see if I can't get it to work exactly how I'd like. I've modified your formula and it's now giving me the distribution of how each partners money is which will be very helpful (50% to property 1, 50% to property 2, etc). However, I am also trying to get it (and maybe this will need to be a new table) to where it shows the percentage ownership of each individual property (property 1 is owned 20% by partner 1, 20% by partner 2, etc). I've added a picture and my 'Ownershipt %' formula to help explain what I'd like. Thanks again for your help and let me know if that's not clear.  

 

sum({<gl_account_type={'Capital'}>}
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)
/
sum({<gl_account_type={'Capital'}>} Total <[Property Name], initial_partners>
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)

 

rwb139_0-1611171453934.png

 

GaryGiles
Specialist
Specialist

I'm not sure what the problem might be.  Back to my original post, this expression should give you the ownership percent for each owner for each property.  Just to be clear, teh initial_partners only has one partner per row.  Correct?

sum({<gl_account_type={'Capital'}>} Total <[Property Name], initial_partners>
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)
/
sum({<gl_account_type={'Capital'}>} Total <[Property Name]>
if(wildmatch(gl_account_name,'*Initial*'), jan)* -1)