Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Calculate date filter

Hello,    I ve been trying to improve my calculation with additional date filter, but it doesnt make any diff. It behaves like it calculates the result for all dates   Everything is calcula...
  • tamerj1's avatar
    tamerj1
    3 years ago

    Anonymous 
    Please try

    Yield Mech. assemblyprevmonth =
    VAR CurrentYearMonth =
        MAX ( 'Date'[Year Month Number] )
    VAR MechAssembly =
        CALCULATETABLE (
            TJob,
            TJob[SekundærNavn] = "Mech. assembly",
            'Date'[Year Month Number] = CurrentYearMonth - 1,
            ALL ( 'Date' )
        )
    RETURN
        ROUND (
            DIVIDE (
                SUMX ( MechAssembly, TJob[FirstPassQty] ),
                SUMX ( MechAssembly, TJob[Antal] )
            ),
            4
        )