Forum Discussion

MalcolmLeong's avatar
MalcolmLeong
Frequent Visitor
8 years ago
Solved

Divide one column by another split by distinct column

This seems simple but I can't seem to get it right. 

 

1.  I have data with columns Channels, Clicks and Impressions.

2.  I want to calculate the Click-Thru-Rate (CTR) by Channels i.e. CTR = Clicks / Impressions 

3.  I did this formula:  CTR = divide (Sum[Clicks] , Sum[Impressions]).

4. The results as below.  i'm not sure how it arrives at this answer (which is incorrect):

 

5. The data looks something like this:

 

Any idea what I did wrongly?

  • Vvelarde's avatar
    Vvelarde
    8 years ago

    MalcolmLeong

     

     

    CTR is a measure or calculated column? 

     

    try with adding Calculate Function.

     

    CTR=Calculate(divide(sum(data[Clicks],sum(data[impresions]))

     

    Regards

     

    Victor Velarde

6 Replies

  • MattAllington's avatar
    MattAllington
    Community Champion

    Looks right to me. Double check everything to make sure the formulas are right etc

    • MalcolmLeong's avatar
      MalcolmLeong
      Frequent Visitor
      Thanks Matt. Yes which is why I couldn't quite figure this out. Double checked and all looked good. Still have a wrong output.
      • MalcolmLeong's avatar
        MalcolmLeong
        Frequent Visitor

        Sorry realise I need to provide more context.

         

        Here is a smaller subset of the data and I will want to calculate the Click-Thru-Rate (CTR) (i.e. CTR = Clicks / Impressions)

         

        However, I cannot get the formula of CTR at the total correct either through this method:

         

        Or this method:

         

        Any reason why this happens?