I have a working formula gathering the MEDIAN of a group of numbers that fall within a date range used in a trend chart in a dashboard. I now want to add two additional criteria for cases when the dashboard user would like to calculate the MEDIAN but exclude certain values (referred to as 'HOLD' and 'Strategic' data) from the median calculation. The working formula is the following but I'm not getting the correct result:
=IF(ISERROR(MEDIAN(COLLECT({Resi - CPA Executed Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE (2024, 6, 1), @cell <= DATE(2024, 6, 30)), {Resi - HOLD}, [Exclude HOLD Data Value]1, {Resi - Strategic}, [Exclude Strategic Dealer Data Value]1))), "", MEDIAN(COLLECT({Resi - CPA Executed Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE (2024, 6, 1), @cell <= DATE(2024, 6, 30)), {Resi - HOLD}, [Exclude HOLD Data Value]1, {Resi - Strategic}, [Exclude Strategic Dealer Data Value]1)))
The last part ({Resi - HOLD}, [Exclude HOLD Data Value]1, {Resi - Strategic}, [Exclude Strategic Dealer Data Value]1) is the new portion where I'm not exactly getting the correct result but I can see what is happening when I did some testing and diagnosis (below):
Current Calc Results 3 LH columns Desired Calc Results 3 RH Columns
My current formula is giving me the median calculations on the the points with the checkmark or without it (LH beige and blue columns) but the results that I am expecting (needing) are on the RH white and blue columns where I am looking for the median of all of the data OR, if the 'Resi - HOLD' boxes are checked in an adjacent column, exclude those data points from the median calculation. How might I need to modify my formula to include all data in the date range or exclude any points that have a checkmark in the 'Resi - HOLD' or 'Resi - Strategic' columns?