Forum Discussion

wolfy_'s avatar
wolfy_
Icon for Helper I rankHelper I
5 years ago
Solved

Average per date day

Hi,

 

Can anyone help me figuring out where I'm faling to calculate tha "average delta" for the "Delta Forcast Date vs Actual Date (days)"

 

For example, for the actual date May 13 the "average delta" should be -23,41 days.

 

 

 

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  wolfy_ ,

    I load your Excel file into Power BI

    And calculate according to the following steps

    1. Create measure.

    Forcast Date vs Actual Date(days) = DATEDIFF(MAX('data'[Forcast Date End]),MAX('data'[Actual]),DAY)
    averge delta = AVERAGEX(FILTER(ALL('data'),'data'[Actual]=MAX('data'[Actual])),[Measure_Delta Forcast Date vs Actual Date(days)])

    2. Result:

    I show the correct number. You can see if there is a filter on your side that has filtered the result, and clear it if there is any.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

6 Replies

  • wolfy_ , is this a measure?

    if yes, values should include the group by of visual

    averagex(values(Query1[Group by]),[Delta Forcast Date vs Actual Date (days)])

     

     

    averagex(summarize(Query1, Query1[Group by],Query2[Group by],"_1" ,[Delta Forcast Date vs Actual Date (days)]),[_1])

     

    if this is a column 

    averagex(Table,[Delta Forcast Date vs Actual Date (days)])

    • wolfy_'s avatar
      wolfy_
      Icon for Helper I rankHelper I

      Hi amitchandak 

      Yes, it is a measure.

      average delta =
      AVERAGEX(
      VALUES(Query1[Actual]),
      [Delta Forcast Date vs Actual Date (days)]
      )



      I did not understood how to proced whit [Group by]
      How should the measure be?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  wolfy_  ,

    Here are the steps you can follow:

    1. Create measure.

    Delta Forcast Date vs Actual Date(days) = DATEDIFF(MAX('Table'[Forcast Date End]),MAX('Table'[Actual]),DAY)
    averge delta =
    AVERAGEX(FILTER(ALL('Table'),'Table'[Actual]=MAX('Table'[Actual])),[Delta Forcast Date vs Actual Date(days)])

    2. Result.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • wolfy_'s avatar
      wolfy_
      Icon for Helper I rankHelper I

      Hi Anonymous 

       

      The solution average delta  you provided is that what I need. After implement it from my side it seems that someting is off.

       

      For example, to Actual of May 14 should be -34 as your example but for me is giving -8,5 day's.

      For May 21 the average should be -24,67 and is -10,99.

       

      It is possible that I'm performing someting wrong?

       

      My meseruments as you said are:

       

      Delta Forcast Date vs Actual Date(days) = DATEDIFF(MAX('Query1'[Forcast Date End]),MAX('Query1'[Actual]),DAY)
       
      averge delta =
      AVERAGEX(FILTER(ALL('Query1'),'Query1'[Actual]=MAX('Query1'[Actual])),[Delta Forcast Date vs Actual Date(days)])

       

      I'm unable to post here the sample table whitout html error's

      here is the link for it

      https://drive.google.com/file/d/1Dl23Q22G_bSEHJZXdgvrRu7lEziKQ_wk/view?usp=sharing

       

      Thanks in advance for the help

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  wolfy_ ,

    I load your Excel file into Power BI

    And calculate according to the following steps

    1. Create measure.

    Forcast Date vs Actual Date(days) = DATEDIFF(MAX('data'[Forcast Date End]),MAX('data'[Actual]),DAY)
    averge delta = AVERAGEX(FILTER(ALL('data'),'data'[Actual]=MAX('data'[Actual])),[Measure_Delta Forcast Date vs Actual Date(days)])

    2. Result:

    I show the correct number. You can see if there is a filter on your side that has filtered the result, and clear it if there is any.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous's avatar
    Anonymous
    Not applicable

    I would try:

    [Average Delta] = Calculate(Average([Delta Forecast Date vs Actual(Date)]), DISTINCT(Table[Actual]))

    --Nate