Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measure not included in average calculation

Hello, I'm trying to get an average from a measure but the last row value (10) is not recognized.   Measure Adj_Avg: If(Calculate(Average('Planned'))=Blank(),10, Average(Billed))     For W...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    Here I will show you two ways to achieve your goal.

    Way1: You can use [Measure Adj_Avg] as the basic and calculate the average of this measure to get correct result in Total.

    Way1 = AVERAGEX('Date',[Measure Adj_Avg])

    Way2: Try this measur, to get correct result directly.

    Way2 = 
    VAR _T1 =
        ADDCOLUMNS (
            'Date',
            "Average of Billed", CALCULATE ( AVERAGE ( Billed[Billed] ), ALLEXCEPT ( Billed, Billed[Date] ) ),
            "Average of Planned", CALCULATE ( AVERAGE ( Planned[Planned] ), ALLEXCEPT ( Planned, Planned[Date] ) )
        )
    VAR _T2 =
        ADDCOLUMNS (
            _T1,
            "Adj_Avg", IF ( [Average of Planned] = BLANK (), 10, [Average of Billed] )
        )
    RETURN
        AVERAGEX ( _T2, [Adj_Avg] )

    I build a sample like yours.

    Result is as below. 

    Best Regards,
    Rico Zhou

     

    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
    5 years ago

    Hi Anonymous 

    I build a sample to have a test, but the measure in my sample works well.

    Employee:

    Billed:

    Planned:

    Relationship:

    Measure:

    Measure = IF(AVERAGE(Billed[Heures facturées]) <20,1,0)
    Measure 2 = SUMX('Employee',[Measure])

    Result:

    I think your problem should be caused by your data model, please check your data model. Employee Table should have all employee name in it. Or you can try Way2 to build a summarize table by code and calculate the result in the summarize table.

    If this reply still couldn't help you solve your problem, I suggest you to submit a new post with more details about data model. Our Employeers will help you solve your problem as soon as possible.

     

    Best Regards,
    Rico Zhou

     

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