Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Calculation error SUMX in table

Hello all,

 

 

I want to create a measure to calculate the Current Ticket  based on the following code:

 

Current Ticket = var currentDate = MAX(OWK_CI_INCIDENTS[IDT_STARTDATUM].[Date]) return SUMX(FILTER(ALL(OWK_CI_INCIDENTS);MONTH(OWK_CI_INCIDENTS[IDT_STARTDATUM].[Date])=MONTH(currentDate)&&YEAR(OWK_CI_INCIDENTS[IDT_STARTDATUM].[Date])=YEAR(currentDate));[REMEDYTICKET_NUMBER])

 

Unfortunat;y i have the following error message :

 

 

 

 

The data type for OWK_CI_INCIDENTS[IDT_STARTDATUM].[Date])  is Date   and for REMEDYTICKET_NUMBER is Text.

 

 

 

 

Thanks for your help!

 

  • Hi Anonymous,

    The error message display clearly that SUM evaluates to numbers or dates, but it can't work with type string. In your resouce table, the data type for REMEDYTICKET_NUMBER is Text, so it return the error. 

    I create sample table similar like yours, but the datatype is number, it works fine.



    Best regards,
    Angelia

2 Replies

  • v-huizhn-msft's avatar
    v-huizhn-msft
    Microsoft Employee

    Hi Anonymous,

    The error message display clearly that SUM evaluates to numbers or dates, but it can't work with type string. In your resouce table, the data type for REMEDYTICKET_NUMBER is Text, so it return the error. 

    I create sample table similar like yours, but the datatype is number, it works fine.



    Best regards,
    Angelia

    • Anonymous's avatar
      Anonymous
      Not applicable

      hI v-huizhn-msft,

       

      Thank you for testing. the REMEDY_TICKET was created as a Text. For example INC0000012345.

      I had to split this column via Delimiter and removed the 'INC'.

       

      Also i changed the SUMX into COUNTX , because i want to count how many remedy tickets have been created in the current year.

       

      have a nice day.