Forum Discussion

amol0512's avatar
amol0512
Helper I
4 years ago
Solved

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...
  • amol0512's avatar
    4 years ago
    Thanks 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())
    )
    Return
    COALESCE(QTDErrorToday,0)
  • OwenAuger's avatar
    OwenAuger
    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 )