Is there anyway to change the calculation for a calculated field programmatically? I have a drop down list with a list of values. 1, 2, 3 4. On selecting one of those values I would like to change the calculated field and for the pivot table to update:
switch(i)
{
case 1:
calcTotalPrice = "\"" + "Sum(Hours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";
break;
case 2:
calcTotalPrice = "\"" + "Sum(SHours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";
break;
case 3:
calcTotalPrice = "\"" + "Sum(DHours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";
break;
case 4:
calcTotalPrice = "\"" + "Sum(THours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";
break;
}
I've tried doing StateHasChanged but that doesn't affect it.