Weighted values of field in QGISCalculating sum of parts of column based on another column using QGIS Field...

Do these large-scale, human power-plant-tending robots from the Matrix movies have a name, in-universe or out?

Dot product with a constant

Question: "Are you hungry?" Answer: "I feel like eating."

How to know if I am a 'Real Developer'

Multiple null checks in Java 8

Identical projects by students at two different colleges: still plagiarism?

Can I legally make a website about boycotting a certain company?

Is layered encryption more secure than long passwords?

Sets which are both Sum-free and Product-free.

How do I handle a blinded enemy which wants to attack someone it's sure is there?

Why Doesn't It Completely Uninstall?

How can I differentiate duration vs starting time

How can a kingdom keep the secret of a missing monarch from the public?

Why don't you get burned by the wood benches in a sauna?

How to play songs that contain one guitar when we have two or more guitarists?

Badly designed reimbursement form. What does that say about the company?

How can I make my enemies feel real and make combat more engaging?

Why do we interpret the accelerated expansion of the universe as the proof for the existence of dark energy?

Why would you use 2 alternate layout buttons instead of 1, when only one can be selected at once

What is the reason behind this musical reference to Pinocchio in the Close Encounters main theme?

What if you do not believe in the project benefits?

Aligning Systems of Equations

Why do single electrical receptacles exist?

Coworker asking me to not bring cakes due to self control issue. What should I do?



Weighted values of field in QGIS


Calculating sum of parts of column based on another column using QGIS Field Calculator?How to group and count attribute data?Elseif Conditional Statement in QGIS Field CalculatorDifference between quotation marks ('single' vs “double”) in QGISSummarizing column in QGIS field calculator?Creating function in function editor in QGISHow to set order of operations for Field Calculation in Network Analyst Evaluator Dialogue?QGIS Field Calculator Results Removed When Saving EditsMaking attribute table field dependent?Summarizing column in QGIS field calculator?NULL to 0 values in vactor attribute table in QGISCalculating percentage using QGIS Field Calculator?How calculate sequential values based on group field?Why can't I multiply values from column named 'length' using field calculator via PyQGIS?Changing Number values to specific text in Attribute table (QGIS)Field Calculator - Calculating Sum based on Different Fields













2















In QGIS in the Attribute Table, I have a field with values.



For this field, I need to calculate the Sum of all its values and divide by the number of values that are not equal to "NULL".



Afterwards, I need to create a new field, where each value of the original field will be divided into the previously calculated (the Sum of all its values and divided by the number of values).



Is it possible to do this with the function editor in the Field Calculator (as this action will be repeated more than once)?










share|improve this question

























  • it would be highly appreciated if you can provide us with a sample of your data and your desired output, alternatively you may describe it. For instance, my values are integers or real, and my output should look like something.

    – Taras
    Nov 7 '18 at 7:16
















2















In QGIS in the Attribute Table, I have a field with values.



For this field, I need to calculate the Sum of all its values and divide by the number of values that are not equal to "NULL".



Afterwards, I need to create a new field, where each value of the original field will be divided into the previously calculated (the Sum of all its values and divided by the number of values).



Is it possible to do this with the function editor in the Field Calculator (as this action will be repeated more than once)?










share|improve this question

























  • it would be highly appreciated if you can provide us with a sample of your data and your desired output, alternatively you may describe it. For instance, my values are integers or real, and my output should look like something.

    – Taras
    Nov 7 '18 at 7:16














2












2








2








In QGIS in the Attribute Table, I have a field with values.



For this field, I need to calculate the Sum of all its values and divide by the number of values that are not equal to "NULL".



Afterwards, I need to create a new field, where each value of the original field will be divided into the previously calculated (the Sum of all its values and divided by the number of values).



Is it possible to do this with the function editor in the Field Calculator (as this action will be repeated more than once)?










share|improve this question
















In QGIS in the Attribute Table, I have a field with values.



For this field, I need to calculate the Sum of all its values and divide by the number of values that are not equal to "NULL".



Afterwards, I need to create a new field, where each value of the original field will be divided into the previously calculated (the Sum of all its values and divided by the number of values).



Is it possible to do this with the function editor in the Field Calculator (as this action will be repeated more than once)?







qgis field-calculator






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 21 mins ago









Taras

2,1002624




2,1002624










asked Nov 7 '18 at 5:51









Екатерина УвароваЕкатерина Уварова

242




242













  • it would be highly appreciated if you can provide us with a sample of your data and your desired output, alternatively you may describe it. For instance, my values are integers or real, and my output should look like something.

    – Taras
    Nov 7 '18 at 7:16



















  • it would be highly appreciated if you can provide us with a sample of your data and your desired output, alternatively you may describe it. For instance, my values are integers or real, and my output should look like something.

    – Taras
    Nov 7 '18 at 7:16

















it would be highly appreciated if you can provide us with a sample of your data and your desired output, alternatively you may describe it. For instance, my values are integers or real, and my output should look like something.

– Taras
Nov 7 '18 at 7:16





it would be highly appreciated if you can provide us with a sample of your data and your desired output, alternatively you may describe it. For instance, my values are integers or real, and my output should look like something.

– Taras
Nov 7 '18 at 7:16










1 Answer
1






active

oldest

votes


















6














First of all, you need to create one additional field in the Attribute Table:




"Output", where the calculated new values will be stored (probably a
real data type).




Then you need to proceed in Expression dialogue using the following formula



CASE
WHEN "YOUR_FIELD" <> 'NULL' THEN "YOUR_FIELD" / (sum("YOUR_FIELD") / count("YOUR_FIELD"))
ELSE NULL
END




A short example



I do have a field with values, that vary between 3 and 300, and also include "NULL" values. See the Attribute Table below.



Attribute_Table



In my case, the sum of all values is 544. The number of values that are not equal to "NULL" is 7.



Then I proceed with a formula in the Expression dialogue with activated Editing mode.



CASE
WHEN "Value" <> 'NULL' THEN "Value" / (sum("Value") / count("Value"))
ELSE NULL
END


Expression_Dialogue



Afterwards, I achieved corresponding new values.



Output





References:




  • Summarizing column in QGIS field calculator?

  • Calculating sum of parts of column based on another column using QGIS Field Calculator?

  • How to group and count attribute data?

  • Elseif Conditional Statement in QGIS Field Calculator

  • Expressions in QGIS

  • Difference between quotation marks ('single' vs “double”) in QGIS






share|improve this answer


























  • Many thanks for the answer, but my action is repeated very often and therefore I needed to create a function in the function editor. in Expression dialogue I also introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END)))

    – Екатерина Уварова
    Nov 9 '18 at 3:45











  • Processing modeller should solve your issue

    – Taras
    Nov 9 '18 at 12:16











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f301639%2fweighted-values-of-field-in-qgis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









6














First of all, you need to create one additional field in the Attribute Table:




"Output", where the calculated new values will be stored (probably a
real data type).




Then you need to proceed in Expression dialogue using the following formula



CASE
WHEN "YOUR_FIELD" <> 'NULL' THEN "YOUR_FIELD" / (sum("YOUR_FIELD") / count("YOUR_FIELD"))
ELSE NULL
END




A short example



I do have a field with values, that vary between 3 and 300, and also include "NULL" values. See the Attribute Table below.



Attribute_Table



In my case, the sum of all values is 544. The number of values that are not equal to "NULL" is 7.



Then I proceed with a formula in the Expression dialogue with activated Editing mode.



CASE
WHEN "Value" <> 'NULL' THEN "Value" / (sum("Value") / count("Value"))
ELSE NULL
END


Expression_Dialogue



Afterwards, I achieved corresponding new values.



Output





References:




  • Summarizing column in QGIS field calculator?

  • Calculating sum of parts of column based on another column using QGIS Field Calculator?

  • How to group and count attribute data?

  • Elseif Conditional Statement in QGIS Field Calculator

  • Expressions in QGIS

  • Difference between quotation marks ('single' vs “double”) in QGIS






share|improve this answer


























  • Many thanks for the answer, but my action is repeated very often and therefore I needed to create a function in the function editor. in Expression dialogue I also introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END)))

    – Екатерина Уварова
    Nov 9 '18 at 3:45











  • Processing modeller should solve your issue

    – Taras
    Nov 9 '18 at 12:16
















6














First of all, you need to create one additional field in the Attribute Table:




"Output", where the calculated new values will be stored (probably a
real data type).




Then you need to proceed in Expression dialogue using the following formula



CASE
WHEN "YOUR_FIELD" <> 'NULL' THEN "YOUR_FIELD" / (sum("YOUR_FIELD") / count("YOUR_FIELD"))
ELSE NULL
END




A short example



I do have a field with values, that vary between 3 and 300, and also include "NULL" values. See the Attribute Table below.



Attribute_Table



In my case, the sum of all values is 544. The number of values that are not equal to "NULL" is 7.



Then I proceed with a formula in the Expression dialogue with activated Editing mode.



CASE
WHEN "Value" <> 'NULL' THEN "Value" / (sum("Value") / count("Value"))
ELSE NULL
END


Expression_Dialogue



Afterwards, I achieved corresponding new values.



Output





References:




  • Summarizing column in QGIS field calculator?

  • Calculating sum of parts of column based on another column using QGIS Field Calculator?

  • How to group and count attribute data?

  • Elseif Conditional Statement in QGIS Field Calculator

  • Expressions in QGIS

  • Difference between quotation marks ('single' vs “double”) in QGIS






share|improve this answer


























  • Many thanks for the answer, but my action is repeated very often and therefore I needed to create a function in the function editor. in Expression dialogue I also introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END)))

    – Екатерина Уварова
    Nov 9 '18 at 3:45











  • Processing modeller should solve your issue

    – Taras
    Nov 9 '18 at 12:16














6












6








6







First of all, you need to create one additional field in the Attribute Table:




"Output", where the calculated new values will be stored (probably a
real data type).




Then you need to proceed in Expression dialogue using the following formula



CASE
WHEN "YOUR_FIELD" <> 'NULL' THEN "YOUR_FIELD" / (sum("YOUR_FIELD") / count("YOUR_FIELD"))
ELSE NULL
END




A short example



I do have a field with values, that vary between 3 and 300, and also include "NULL" values. See the Attribute Table below.



Attribute_Table



In my case, the sum of all values is 544. The number of values that are not equal to "NULL" is 7.



Then I proceed with a formula in the Expression dialogue with activated Editing mode.



CASE
WHEN "Value" <> 'NULL' THEN "Value" / (sum("Value") / count("Value"))
ELSE NULL
END


Expression_Dialogue



Afterwards, I achieved corresponding new values.



Output





References:




  • Summarizing column in QGIS field calculator?

  • Calculating sum of parts of column based on another column using QGIS Field Calculator?

  • How to group and count attribute data?

  • Elseif Conditional Statement in QGIS Field Calculator

  • Expressions in QGIS

  • Difference between quotation marks ('single' vs “double”) in QGIS






share|improve this answer















First of all, you need to create one additional field in the Attribute Table:




"Output", where the calculated new values will be stored (probably a
real data type).




Then you need to proceed in Expression dialogue using the following formula



CASE
WHEN "YOUR_FIELD" <> 'NULL' THEN "YOUR_FIELD" / (sum("YOUR_FIELD") / count("YOUR_FIELD"))
ELSE NULL
END




A short example



I do have a field with values, that vary between 3 and 300, and also include "NULL" values. See the Attribute Table below.



Attribute_Table



In my case, the sum of all values is 544. The number of values that are not equal to "NULL" is 7.



Then I proceed with a formula in the Expression dialogue with activated Editing mode.



CASE
WHEN "Value" <> 'NULL' THEN "Value" / (sum("Value") / count("Value"))
ELSE NULL
END


Expression_Dialogue



Afterwards, I achieved corresponding new values.



Output





References:




  • Summarizing column in QGIS field calculator?

  • Calculating sum of parts of column based on another column using QGIS Field Calculator?

  • How to group and count attribute data?

  • Elseif Conditional Statement in QGIS Field Calculator

  • Expressions in QGIS

  • Difference between quotation marks ('single' vs “double”) in QGIS







share|improve this answer














share|improve this answer



share|improve this answer








edited 17 mins ago

























answered Nov 7 '18 at 6:44









TarasTaras

2,1002624




2,1002624













  • Many thanks for the answer, but my action is repeated very often and therefore I needed to create a function in the function editor. in Expression dialogue I also introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END)))

    – Екатерина Уварова
    Nov 9 '18 at 3:45











  • Processing modeller should solve your issue

    – Taras
    Nov 9 '18 at 12:16



















  • Many thanks for the answer, but my action is repeated very often and therefore I needed to create a function in the function editor. in Expression dialogue I also introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END)))

    – Екатерина Уварова
    Nov 9 '18 at 3:45











  • Processing modeller should solve your issue

    – Taras
    Nov 9 '18 at 12:16

















Many thanks for the answer, but my action is repeated very often and therefore I needed to create a function in the function editor. in Expression dialogue I also introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END)))

– Екатерина Уварова
Nov 9 '18 at 3:45





Many thanks for the answer, but my action is repeated very often and therefore I needed to create a function in the function editor. in Expression dialogue I also introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END)))

– Екатерина Уварова
Nov 9 '18 at 3:45













Processing modeller should solve your issue

– Taras
Nov 9 '18 at 12:16





Processing modeller should solve your issue

– Taras
Nov 9 '18 at 12:16


















draft saved

draft discarded




















































Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f301639%2fweighted-values-of-field-in-qgis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Щит и меч (фильм) Содержание Названия серий | Сюжет |...

is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

Meter-Bus Содержание Параметры шины | Стандартизация |...