How can I create a calculated field to calculate passing rate using 2 colums for pass and fail

Screenshot 2023-01-25 033824
My data set looks like this how can I calculate passing rate % using Pass and Failed columns

How do you want to handle Nulls? Something basic could look like this.

sum(ifelse({pass_or_fail}=‘P’,{Final_Rating},0))/ifelse((sum(ifelse({pass_or_fail}=‘P’,{Final_Rating},0))+ sum(ifelse({pass_or_fail}=‘F’,{Final_Rating},0)))=0,1,(sum(ifelse({pass_or_fail}=‘P’,{Final_Rating},0))+ sum(ifelse({pass_or_fail}=‘F’,{Final_Rating},0))))