Forum Discussion

SantiagoTorres's avatar
4 years ago

Calculate Average

Hi all,

 

I'm working on a chart that shows the number of visits in a period. I'm using a line chart with the following variables:

Assignee(S): Text values (names)

Date Created: Dates values

and, Site Visits/day: Measure

Site Visits/day = DIVIDE[Site Visits], [Workdays])
Site Visits = COUNTROWS(SUMMARIZE('4. CoW Productivity', '4. CoW Productivity'[Project Number], '4. CoW Productivity'[Date Created]))
Workdays = COUNTROWS(SUMMARIZE('4. CoW Productivity','4. CoW Productivity'[Date Created]))

 

I have included an Average line from Analytics which shows a value of 3.06 Avg Site Visits/day.

 

My question is, how can I calculate the same value with a DAX measure??

 

Many thanks,

 

Andres Torres

3 Replies

  • SantiagoTorres ,

    Try like

    Site Visits/day = calculate( DIVIDE[Site Visits], [Workdays]), allselected())
     
    Site Visits/day = calculate( DIVIDE( [Site Visits], [Workdays]), all())
    • SantiagoTorres's avatar
      SantiagoTorres
      Helper I

      Hi amitchandak, hope you're well. Thanks for your response,

       

      I've tried this:

       

      Site Visits/day = calculate( DIVIDE[Site Visits][Workdays]), allselected()), and

      Site Visits/day = calculate( DIVIDE( [Site Visits][Workdays]), all()),

       

      Returns: 10.40

      In theory, that value is correct in terms of all the data I have, but I need to get (As shown in the capture from my previous message) the Avg calculated automatically by Avg Line 3.06.

       

      Including the Assignee(S) in the previous chart with a value of 10.4, I got this:

       

       

      However, I don't know to get an average from these values for every Assignee(S) (Inspector), which I think is the value I'm looking for,  correct? Just guessing, something maybe like ((3.36+3.25+3.14+3+2.78)/5)

       

      Thanks,

       

      Andres Torres

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi SantiagoTorres ,

     

    Could you please share me with your pbix file after removing sensitive data?

     

    Best Regards,
    Eyelyn Qin