I create a report from attribute table. At one column I have a name of a street, at second column I have a number. Relation between street and a number is one-to-many. Is there a function to show at the report table name of a street only for biggest number or alternativelly group the column with name of a street the same way it is possible in MS excel, as shown at the picture below?
1 Answer 1
Use this expression:
if (
maximum( number,"street" )=
attribute( get_feature_by_id (@layer, $id), 'number'),
street,
''
)
Screenshot: I used the same values as in your screenshot, see the result: enter image description here
-
Thank you. I have "NULL" in some street fields. What is incorrect on function if("street" IS NULL, ' ',(if ( maximum( number,"street" )= attribute( get_feature_by_id (@layer, $id), 'number'), street, '' ))?pazelvak– pazelvak2021年06月24日 13:48:01 +00:00Commented Jun 24, 2021 at 13:48
-
You have simply forgot one closing bracket
)
at the end. If you have aNULL
value, result will beNULL
as wellBabel– Babel2021年06月24日 13:57:56 +00:00Commented Jun 24, 2021 at 13:57 -
But you don't need any special if-clause for
NULL
, the expression from my solution works well even forNULL
values.Babel– Babel2021年06月24日 14:00:41 +00:00Commented Jun 24, 2021 at 14:00
Explore related questions
See similar questions with these tags.
maximum()
i.e.maximum("number", group_by:="Street")
and thesum()
i.e.sum("number", group_by:="Street")
functions