Forum Discussion

stevezly's avatar
stevezly
Icon for Helper I rankHelper I
4 years ago
Solved

Median giving incorrect values

Hi All, 
 
I am trying to calculate median over some grouped data, but the "median" value I get back is the same for each group which cannot be correct. Am I missing something here?
 
Thanks
 
SummTable =
ADDCOLUMNS(
SUMMARIZE(pack_et,
pack_stimuli[stimuli_country],
pack_stimuli[stimuli_category],
pack_et[zone],
pack_projects[year],
pack_stimuli[stimuli_region],
pack_stimuli[stimuli_design]), "Median", MEDIAN(pack_et[avg(seen)]


 
 
)

)
  • It would be returning the median across the entire dataset, it wouldn't be split into any categories.

16 Replies

  • It would be returning the median across the entire dataset, it wouldn't be split into any categories.

    • stevezly's avatar
      stevezly
      Icon for Helper I rankHelper I

      Thanks John.

       

      Is there anyway I could get these to match up do you think?

       

      Basically I'm having to use a summary column in order to bypass RLS and create benchmarks, but I can't think of a way to calculate median in a way that would tie up with the rest of the report.

       

      Thanks for your help so far

      • johnt75's avatar
        johnt75
        Icon for Super User rankSuper User

        If you add the CALCULATE then the summary table should be correct, with the correct median per category.

  • You need to wrap the MEDIAN call inside CALCULATE() so that it picks up the row context from the SUMMARIZE.

    • stevezly's avatar
      stevezly
      Icon for Helper I rankHelper I

      Ah thanks, was being silly. 

       

      It is strange though. The values I am getting for "Median" do not match up with  spot checked values from the main Median measure, when i filter down into these groups.