Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
5 years ago
Solved

Problems with PREVIOUSDAY

Hello!

I have a project in which I have a table of the current month ("mes_curso"), where daily information is added, and another table where I consolidated the previous months with the current ("Unified").

The idea is to have, by day, the pending records, and the pending of the previous day. With this I'll do other calculations later.

Table 1 is designed with "mes_curso" data, and has the exact output I'm waiting for. Instead, Table 2 is designed with "Unified" data, and yet the field pend_ant not show me what was expected. It should be noted that the tables have exactly the same filters applied, except that I applied filter to Table 2 in Date to be able to compare.

tablas.JPG

In Table 1, pend_ant has the following syntax

pend_ant = CALCULATE(COUNT(mes_curso[Descripcion]),PREVIOUSDAY(mes_curso[Fecha_anterior]))
In Table 2, pend_ante has the following syntax
pend_ante - CALCULATE(COUNT(Unified[Description]),PREVIOUSDAY(Unified[Fecha_anterior]))

What may be failing in Table 2?

Thanks a lot!

  • Syndicate_Admin , I doubt table 2 might have timestamp for few dates

    Create a date like

     

     

    Date = [Fecha_anterior].date
    or
    Date = date(year([Fecha_anterior]),month([Fecha_anterior]),day([Fecha_anterior]))

     

    Also it better to use Date table for time intelligence   // assuming you are creating a measure

    [Tabpend_ante] - CALCULATE(COUNT(Unified[Description]),PREVIOUSDAY(Date[Date]))

     

     

     

2 Replies

  • Syndicate_Admin , I doubt table 2 might have timestamp for few dates

    Create a date like

     

     

    Date = [Fecha_anterior].date
    or
    Date = date(year([Fecha_anterior]),month([Fecha_anterior]),day([Fecha_anterior]))

     

    Also it better to use Date table for time intelligence   // assuming you are creating a measure

    [Tabpend_ante] - CALCULATE(COUNT(Unified[Description]),PREVIOUSDAY(Date[Date]))

     

     

     

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Administrator

      Thanks a lot.

      I don't know what was going on, because Fecha_anterior was as a date.

      I solved it by creating a Calendar table, Fecha_anterior to Calendar.