Forum Discussion
Anonymous
3 years agoNot applicable
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...
- 3 years ago
Anonymous
Please tryYield 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 )
tamerj1
Community Champion
3 years agoHi Anonymous
bring CALCULATE at line number 2 instead of 5
Anonymous
3 years agoNot applicable
Could you elaborate more? You mean putting sumx as VAR?
Yield Mech. assembly =
VAR nom =
CALCULATE( SUMX(TJob, TJob[Antal]), TJob[SekundærNavn] = "Mech. assembly" , PREVIOUSMONTH(TJob[Dato]))
VAR den =
CALCULATE(SUMX(TJob, TJob[FirstPassQty]), TJob[SekundærNavn] = "Mech. assembly", PREVIOUSMONTH(TJob[Dato]))
RETURN
ROUND(
DIVIDE (
den,
nom),
4)
- tamerj13 years ago
Community Champion
Anonymous
Please try
Yield Mech. assembly111 =
CALCULATE (
VAR MechAssembly =
FILTER ( TJob, TJob[SekundarNavn] = "Mech. assembly" )
RETURN
ROUND (
DIVIDE (
SUMX ( MechAssembly, TJob[Antal] ),
SUMX ( MechAssembly, TJob[FirstPassQty] )
),
4
),
PREVIOUSMONTH ( TJob[Dato] )
)- Anonymous3 years agoNot applicable
Idk know why but the measure keeps displaying blank after previous month function. So as few others i had try for example
Date column is correctly formatted as date, rest as whole number.
- tamerj13 years ago
Community Champion
Anonymous
Does this work for you?