Question, how to divide two aggregate
See original GitHub issuesorry, I could not find anything in the documentation how to divide two aggregate, I am using this syntax but I am stuck, all I want is to create a new aggregation new, which is the division of two aggregation sum(Installed_qty) and sum(budget)
bar = alt.Chart(df).transform_calculate(
new='sum(Installed_qty)'/'sum(budget)'
).mark_bar().encode(
x=alt.X("date:O", timeUnit="yearmonthdate",axis=alt.Axis(format="%d %b %y")),
y='new:Q'
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Dividing two aggregate measures
I have 2 calculations that I'm trying to divide, but it's always giving me 0. 1st calc - If Medication = "drug type...
Read more >python 3.x - How to divide two aggreate sum dataframe
1 Answer 1 ... Your approach was correct, but you could just do the calculation inside the aggregation function only. from pyspark.sql import ......
Read more >How to divide outputs of two fields? - Question and Answer
How to divide outputs of two fields? · count() is inside sum() , making it a nesting of aggregation · even without sum()...
Read more >$divide (aggregation) — MongoDB Manual
Divides one number by another and returns the result. Pass the arguments to $divide in an array. ... The first argument is the...
Read more >Table Calculations How to divide two different columns using ...
Tableau - Table Calculations How to divide two different columns using aggregate. When using measures and measure values you wont be able to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s a bit awkward in the Vega-Lite transform syntax, but you have to create two aggregate transforms and then divide them within a calculate transform. e.g.
If you’re using a pandas dataframe, it might be cleaner to add columns with the computed values.
You are applying the
pts
filter after the calculate and aggregate transforms, which is probably not what you want. Transforms are applied in the order they are specified.