Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Creating industry average

Hi!

I would like to calculate an industry average of total visits. How do i do that? 

I have to tables. 

Table 1: 

Customer name

Industry name

Customer 1Industry 1
Customer 2Industry 2
Customer 3Industry 1

 

Table 2

Customer nameDateVisits
Customer 115.06.2020102
Customer 215.06.20202034
Customer 315.06.2020540
Customer 116.06.2020203
Customer 216.06.20203042
Customer 316.06.2020654

 

So the result would be: 

Total visits of customer 1 = 305

Total visits of customer 2 = 5.076

Total visits of customer 3 = 1.194
Total visits of industry 1 = 1.499 

Total visits of industry 2 = 5.076

Industry 1 average = 749,5

Industry 2 average = 5.076 

 

The output i want to generate is: 

Industry nameIndustry average
Industry 1749,5
Industry 25.076 

 

I hope you can help me! 

  • Try by creating 2 measures. Make sure that Industry and Visits table are joined properly

    m_SUMVisits = SUM(Visits[Visits])
    m_Avg = AVERAGEX(VALUES(Industry[Customer name]),[m_SUMVisits])

     

3 Replies

  • FarhanAhmed's avatar
    FarhanAhmed
    Icon for Community Champion rankCommunity Champion

    Try by creating 2 measures. Make sure that Industry and Visits table are joined properly

    m_SUMVisits = SUM(Visits[Visits])
    m_Avg = AVERAGEX(VALUES(Industry[Customer name]),[m_SUMVisits])

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi FarhanAhmed 

       

      THANK YOU SO MUCH! I love this community! 😄 

      It worked like a charm! 

      For anyone in the future, my final two measures was named: 

      Total visits = SUM('Sessions (SessionStats)'[Total sessions])
       
      Visits average = AVERAGEX(VALUES(Customers[Customer name]),[Total visits])
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi FarhanAhmed 

       

      Do you also happen to know how i can present the industry average next to each customers value? 

      Like this: 

      Customer nameTotal visits Industry average (m_avg)
      Customer 13051.499 
      Customer 25.0765.076
      Customer 31.1941.499 

       

      When i select the measure you helped me create "m_avg" it just shows the total visits in "Industry average" 

      And if you also have the time I created industry averages for other values such as "Avg. order value industry average": "

      Avg. order value industry average = AVERAGEX(VALUES(Customers[Customer name]),[Avg. order value])

      But i would like to weigh the values by the percentage of visits that each customer have in the industry. So i get the following results below. 

      Customer nameTotal visitsIndustry total visits% of industry total visitsAvg. order value
      Customer 13051.49920,3520
      Customer 25.0765.07610050
      Customer 31.1941.49979,6530
       
      IndustryAvg. order value industry           (Old calculation result) Avg. order value industry    (Wanted result)
      Industry 1(20+30) / 2 = 2520*20,35%+30*79,65% = 27,965
      Industry 25050