Forum Discussion

ScottBrown's avatar
ScottBrown
Helper II
4 years ago
Solved

DAX Help - Partially created from Time Intelligence

I need filtering this down a little further,

  • Need to filter the weekIndex to be greater than or equal to -20
  • How do I round the answer = currently is 22.67 which is correct
AVG Weekly Production Last 20 Wks =
AVERAGEX(
    KEEPFILTERS(VALUES('DimDates'[weekIndex])),
    CALCULATE(COUNT('Production_Stock_OrderLines_HIST-PROD'[txtOrdNo])
))
 
Thnaks in Advance
  • Is this what you mean?

    AVG Weekly Production Last 20 Wks =
    ROUND (
        AVERAGEX (
            FILTER ( VALUES ( 'DimDates'[weekIndex] ), 'DimDates'[weekIndex] >= -20 ),
            CALCULATE ( COUNT ( 'Production_Stock_OrderLines_HIST-PROD'[txtOrdNo] ) )
        ),
        0
    )

2 Replies

  • Is this what you mean?

    AVG Weekly Production Last 20 Wks =
    ROUND (
        AVERAGEX (
            FILTER ( VALUES ( 'DimDates'[weekIndex] ), 'DimDates'[weekIndex] >= -20 ),
            CALCULATE ( COUNT ( 'Production_Stock_OrderLines_HIST-PROD'[txtOrdNo] ) )
        ),
        0
    )