Forum Discussion

venildo_amaral's avatar
venildo_amaral
New Member
3 years ago

Problem with DatesYTD - It does not accumulate when a field has no value

Turnover Qtd Demitidos Ate Mes =
var Retorno = CALCULATE
    (
        count(fatoAtivo[id]),
        fatoAtivo[TipoDado]=2,
        fatoAtivo[Demitido]=True,
        DATESYTD(calendario[Data])
    )
return if(ISBLANK(retorno),0,Retorno)


I made the measurement above, with the aim of accumulating the number of records from the beginning of the year to the selected month, if I put it on a card it works normally, it brings the total correctly, however if I put it in a matrix opened by the "CargoPiramide" field , and in a given month there is no value for this field, the accumulation for that month is not performed.
For example, in the month of Jan'2023 there were 3 directors dismissed, in the month of Feb'2023 none, when I select the month of Feb'2023, the value of the director in the matrix is zeroed, and the right thing to do was to come 3, which is the amount that it had in the previous month, but the current month, as the current month has no value, so the result should be 3, when information appears on the following month, the sum is correct, the problem is only when a month does not give you information, so that month does not appear the accumulated until it, it is simply zeroed.
How to resolve this to measure?

3 Replies

    • venildo_amaral's avatar
      venildo_amaral
      New Member

      As you can see on screen 1, when the month of Jan'2023 is selected, 2 records appear in the dismissed for director, when the month of Feb'2023 is selected, the director is reset, the 2 should come here, as it is accumulated from Jan'2023.
      Thanks

      • venildo_amaral's avatar
        venildo_amaral
        New Member

        Adding to the previous answer, I realized that the problem is opening the columns by Dismissed and Admitted, I put the same measure inside a table and the result is correct, but when it is inside the matrix, it gives the error mentioned above.

        In the image below you can see that when it is a table, the director's record appears with 2