Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create a median for a dimension

All,

Attached is a sample Qlikview data, want to calculation media by type ,but use  media function , can't get  correct  result,

attachment is test value.

  

typedatesum(value)median(total <type> aggr(sum(value),type))
M001201312013,407,67327,468,149
M001201312023,704,43527,468,149
M001201312033,646,97227,468,149
M001201312043,584,32727,468,149
M001201312053,305,34027,468,149
M001201312062,760,66627,468,149
M001201312072,269,94627,468,149
M001201312082,025,42527,468,149
M00120131209448,76427,468,149
M001201312102,314,60127,468,149
M0022013120134,235,263261,747,333
M0022013120234,434,302261,747,333
M0022013120334,992,754261,747,333
M002201312043,121,676261,747,333
M0022013120530,514,319261,747,333
M0022013120620,516,230261,747,333
M0022013120722,160,540261,747,333
M0022013120832,114,195261,747,333
M0022013120926,649,151261,747,333
M0022013121023,008,903261,747,333
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Because the median itself is an aggregation function. And, there is nothing great making anything unnecessarily difficult, so it's easy .

Please mark 'Correct Answer' and close the thread.

View solution in original post

6 Replies
lironbaram
Partner - Master III
Partner - Master III

when using aggr function

it's important to include all the dimensions relevant to the aggregation level 

use this function

Median(total <type>aggr(sum(value),type,date))

tresesco
MVP
MVP

May be a bit simpler like this?

median(total <type> value)

Not applicable
Author

Thanks,it;s right

I calculation median of the gap with sum(value) and Median(total <type>aggr(sum(value),type,date)) ,but then occur nothing,can't calculation again?

Not applicable
Author

Yes ,the result is right ,why the formula so easy, thanks

tresesco
MVP
MVP

Because the median itself is an aggregation function. And, there is nothing great making anything unnecessarily difficult, so it's easy .

Please mark 'Correct Answer' and close the thread.

Not applicable
Author

Could you help check I replay under Liron Baram , Thanks.