Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
MChapp
Contributor
Contributor

Pivot Table - Select Dimension Value From Sum Measure

I have a pivot table where a Claimant ID could have two different Policy_Name for the same period:

Claimant IDRelationshipPolicy_NamePeriod2020-012020-022020-03
dc0d0aa5f56ad27SpouseHSA Plan -$35,816.29$39,351.31
dc0d0aa5f56ad27SpousePPO Plus Plan $76,226.88$76,226.88$76,226.88
840c248c19359b2SpousePPO Plan $2,064.24$2,206.29$2,206.29
840c248c19359b2SpousePPO Plus Plan $62,536.81$102,302.02$103,459.70

 

My requirements are to sum payment amount by Claimant ID and to pick the policy name that had contributed the highest percentage to the total summed claims.  The results should look like this:

Claimant IDRelationshipPolicy_NamePeriod2020-012020-022020-03
dc0d0aa5f56ad27SpousePPO Plus Plan $76,226.88$112,043.17$115,578.19
840c248c19359b2SpousePPO Plus Plan $64,601.05$104,508.31$105,665.99

 

Is this possible?   My expression is already a set analysis:

Sum({<[WHLarge_Claims.Period]={$(=concat(DISTINCT chr(39) & [Large Claim Month Selector] & chr(39), ','))}>}[Payment_Amount])
 

3 Replies
sunny_talwar

May be use a calculated dimension for Policy_Name

Aggr(
    FirstSortedValue(Policy_Name, -Aggr(Sum([Payment_Amount]), [Claimant ID])
, [Claimant ID])

 

MChapp
Contributor
Contributor
Author

Sunny, 

Correct me if I'm wrong but doesn't FirstSortedValue grab the first value loaded into the table? My highest Payment_Amount will not always be the first row loaded.  

sunny_talwar

It will pick the First Values based on sorting. In our case, we are telling to pick the first value where Policy_Name is sorted in descending order of Sum of Payment_Amount