Forum Discussion
Jack Klosterman
May 02, 2018Copper Contributor
Use a function in a custom field in pivot table
I'm trying to add a custom field to a pivot table using sumif function. My data has records for both hours and OT. I would like a pivot table to show the total hours for all types i.e. (Reg, OT, Si...
SergeiBaklan
May 03, 2018Diamond Contributor
Hi Jack,
If your table is added to data model you may right click on table name like here
and add measure
=CALCULATE(SUM(Table1[Hours]),Table1[Type]="OT")/CALCULATE(SUM(Table1[Hours]),ALL(Table1[Type]))
or divide on SUM to show % of OT to all other types.
Please see attached.