Forum Discussion
amol0512
4 years agoHelper I
QTD MTD Incorrect result
Hi, I am trying to show QTD and MTD numbers in a card on the top. But they are not showing currect result. I have data from Jan 2021 and Jan 2022 and I have 1 error for Jan 2022. so ideally it should...
- 4 years agoThanks for your help,I tried but its giving an error now."Parameter is not the correct type"Sample QTD Errors =Var QTDErrorToday =CALCULATE([Total Errors],DATESQTD('Calendar'[Date] =TODAY()))ReturnCOALESCE(QTDErrorToday,0)
- 4 years ago
That's odd - that syntax works for me in a test model.
Does this alternative syntax work, using TREATAS for the filter on today instead of the boolean expression?
Sample QTD Errors = VAR QTDErrorToday = CALCULATE ( [Total Errors], DATESQTD ( TREATAS ( { TODAY () }, 'Calendar'[Date] ) ) ) RETURN COALESCE ( QTDErrorToday, 0 )
OwenAuger
4 years agoSuper User
That's odd - that syntax works for me in a test model.
Does this alternative syntax work, using TREATAS for the filter on today instead of the boolean expression?
Sample QTD Errors =
VAR QTDErrorToday =
CALCULATE (
[Total Errors],
DATESQTD ( TREATAS ( { TODAY () }, 'Calendar'[Date] ) )
)
RETURN
COALESCE ( QTDErrorToday, 0 )
Anonymous
4 years agoNot applicable
Hi ,
I used this formula but as soon as i change the year to 2021,2020 or 2019 the Value goes to zero.
Posting my formula i may have misconcept it ,
please help!!
CY MTD =
Var MTDTotal =
CALCULATE([Total sale],
DATESMTD( TREATAS( {TODAY()} ,'Main Sheet'[Order Date] ))
)
Return
COALESCE(MTDTotal,0)