
1. Re: SUM Selected Measures in Data
Derrick Austin Jun 16, 2016 7:46 AM (in response to André Coelho) 
2. Re: SUM Selected Measures in Data
André Coelho Jun 17, 2016 5:06 AM (in response to Derrick Austin)Hi Derrick.
It's not that simple. If you sum those measures in view the result will be R$2961746,81.
The result adding Grand Total is R$ 48196664,07.
I'm struggling with it, I thought it would be easier.
I tried window_sum but didn't work fine.
If you could find other solutions it would be great.
Thank you.

3. Re: SUM Selected Measures in Data
Derrick Austin Jun 17, 2016 7:03 AM (in response to André Coelho)Hey Andre,
The reason you are seeing 48M is because the total is including the values you are filtering out with "Distance from Origin".
Looking at the calculation, I'm not 100% what it is trying to do, but do you need the window functions there? If we can rewrite that so that it doesn't have them, I think we can adjust this to work correctly.

4. Re: SUM Selected Measures in Data
André Coelho Jun 17, 2016 7:48 AM (in response to Derrick Austin)Hi Derrick, the goal of this sheet is to show only the SUM of selected (Cities).
The filter "Distance from Origin" was the way I found to show on the map only within less than the value in filter far, based on latitude and longitude.
First you have to select Origin City, after that you select the max distance on "Distance from Origin" filter. All cities in this distance radius will be shown. Then, I need to calculate the SUM of these values.
I failed miserably trying this SUM.

5. Re: SUM Selected Measures in Data
Derrick Austin Jun 17, 2016 7:57 AM (in response to André Coelho)Change it to this:
6371 * ACOS
(
SIN(RADIANS({MAX(IF [Origin City] = [Mun/UF] THEN [Latitude] END)})) * SIN(RADIANS([Latitude])) +
COS(RADIANS({MAX(IF [Origin City] = [Mun/UF] THEN [Latitude] END)})) * COS(RADIANS([Latitude])) *
COS(RADIANS([Longitude])  RADIANS({MAX(IF [Origin City] = [Mun/UF] THEN [Longitude] END)}))
)
Drag it to "dimensions" (Because it is a dimension), then filter with it like this:

6. Re: SUM Selected Measures in Data
André Coelho Jun 17, 2016 1:14 PM (in response to Derrick Austin)Thank you Derrick. Worked Finee!!