3 Replies Latest reply: Oct 3, 2018 3:47 AM by Martin Lundborg RSS

    Sum field based on a measure

    Martin Lundborg

      Hi,

       

      I have the following data: Revenue, Profit, Customer and YearMonth.

       

      I need to show the combined Revenue and count of Customers in a given month (Dimension in my chart) that has a margin (Profit / Revenue) below a given threshold. The threshold is controlled by a slider, who's value is stored in a variant (vSlider).

       

      I have tried different variations of formulas with aggr, rangesum, if etc. without luck.

      One example:

      sum(if(aggr(sum([Profit])/sum([Revenue]), Customer, YearMonth)<=vSlider,[Revenue]))

       

      Can someone help me crack this?

       

      Thanks in advance