
1. Re: Conditional aggregation or an aggregation on condition?
Zhouyi Zhang Aug 21, 2018 5:21 AM (in response to Terese Prascieniute)3 of 3 people found this helpfulHi, Terese
Please see my explain below (I made a bit of data modification to show a better case for understanding)
Hope this helps
ZZ

2. Re: Conditional aggregation or an aggregation on condition?
Michael Ye Aug 21, 2018 5:22 AM (in response to Terese Prascieniute)3 of 3 people found this helpfulTerese,
In your first calcs, the condition is max([Month]) = max({max([Month])}), this will always return true no matter which month it is (because in the left side, it is 20180701, in the right side, it is also 20180701. This condition is just like if 1=1, then....), so when sum 6 records. it will be 6.
In your second calcs, the logic function "if then" will always return 1 since only 20180701 is accordance with the calculation, when sum it, also return 1, because SUM(1)=1.
Hope it helps.
Michael Ye

3. Re: Conditional aggregation or an aggregation on condition?
Michael Gillespie Aug 21, 2018 5:27 AM (in response to Terese Prascieniute)2 of 2 people found this helpfulTerese, this is a fun one.
If we express these 2 calculations in English, I think you'll see the differences.
1) If the highest value in the "Month" column is the same as the the highest value of the highest value of the "Month" column, the SUM all the values in the "Metric" column.
2) Find the row(s) in the table where the value in the "Month" column is equal to the highest value in the "Month" column, and SUM the values in the "Metric" column for those rows only.
In the first calculation, you're just saying that, as long as the 2 MAX values are equivalent, then SUM the "Metric" column. It is impossible for the result of the IF statement to be anything but TRUE.
In the second calculation, you're basically filtering the table to a subset of rows based on a condition, and then SUMming the "Metric" values for the subset of rows you found.

4. Re: Conditional aggregation or an aggregation on condition?
Terese Prascieniute Aug 21, 2018 9:32 AM (in response to Michael Gillespie)Thanks Michael!
Plain English was what I needed.