Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max field value?

Hello,

Please see my attached example.

I would like to show data for all fields but only when the values in the specified field are equal to the Maximum value of that field.

In this case i only want to show rows where journey_length is the largest value specific to the JoinField dimension - i have marked the rows in bold.

I created the expression =aggr(max(journey_length),JoinField) but this does not work as i expected- the MaxLength is not shown against the records i expected.

I had initially planned to modify the Duration expression to sum the Journey_Duration if the MaxLength is equal to avg (journey_length) but as the Max length is not calculated in every row i am stumped.

This has been a difficult question to express in black and white so if there are any questions please get in touch.

Please see the attached spreadsheet for an export of my table along with the expressions.

Regards

4 Replies
Gysbert_Wassenaar

I think you want only Joinfield as dimension and max(journey_length) and avg(journey_length) as expressions.


talk is cheap, supply exceeds demand
Not applicable
Author

That doesnt work because it then totalises Duration regardless of whether journey length is equal to the maxlength.

Anyone else have any ideas? can i do it in the load?

Gysbert_Wassenaar

See attached qvw. Is that what you need?


talk is cheap, supply exceeds demand
Not applicable
Author

It does seem to work for the extract i posted but i cant make it work for the source data, i'll persevere with it