Forum Discussion

OzcarHui07's avatar
OzcarHui07
Advocate I
9 years ago
Solved

Urgently - Problems with function Today (), in Power BI Service

Hello everyone

 

I have problems with function Today (), in Power BI Service


I have made a report on the measure: Requested Quantity of today, without making a filter.

I then send my report to Power BI Service and when I refresh the report, it does not show anything about the measure.

 

Example: Here in Power BI Desktop, this report run perfect la fuction today() for Cant. Solicitada, Cant. Programada, Promedio x Día, Desviación Estándar.

 

The formulas are: 

* Cant. Solicitado Hoy = CALCULATE(SUM(FactVentas[CantidadSolicitada]);DimCanalVenta[ECanalVenta] = 2 ; DimTiempo[Fecha] = TODAY())

* Cant. Programado Hoy = CALCULATE(SUM(FactVentas[CantidadProgramada]); DimCanalVenta[ECanalVenta] = 2; DimTiempo[Fecha] = TODAY())

* Promedio Sol x Día = CALCULATE(DIVIDE([CantSol];[Numero de Dias]); DimCanalVenta[ECanalVenta] = 2 ;DimTiempo[DiaSemana] = WEEKDAY(TODAY();2))

* Desviación Estándar = CALCULATE(STDEV.P(FactCantidadSolicitadaFecha[CantidadSolicitadaFecha]);DimTiempo[DiaSemana] = WEEKDAY(TODAY();2))

 

This run perfect in Power BI Desktop

but when i run in Power BI Sevice

:( help me

Power BI Desktop: 

 

  And when I show this same report in Power BI Service:

 

 

Have I done something wrong?
Or how it works today () in power bi service
All help will be well received.

 

Help me!

 

Thanks 

 

  • Hi OzcarHui07

     

    What happens is when you use the TODAY() function in the Power BI Desktop it uses your Local System time to determine this.

     

    When you upload your file to the Power BI Service, what I can gather from testing is that all the Power BI Servers time is set to UTC. So if you are in a timezone that is say -10 UTC, then due to this it is not today, but according to the Power BI Servers showing as tomorrow.


    What I suggest you do, is to alter your Today with -10 hours in the Query Editor?

     

    So something like this.

    TodaysDate = DateTime.From(DateTimeZone.SwitchZone(DateTimeZone.FixedLocalNow(),-10))
  • Hi GilbertQ


    Its perfect, thanks so very much, now i can show without problems.
    I resolved the them of UTC, also the zone time.

    although, only i have created a other column more of Date in the dimension time and it was asignated data type as Data / Time /TimeZone in the edit queries.

     

    Thanks.

4 Replies

  • Hi OzcarHui07

     

    What happens is when you use the TODAY() function in the Power BI Desktop it uses your Local System time to determine this.

     

    When you upload your file to the Power BI Service, what I can gather from testing is that all the Power BI Servers time is set to UTC. So if you are in a timezone that is say -10 UTC, then due to this it is not today, but according to the Power BI Servers showing as tomorrow.


    What I suggest you do, is to alter your Today with -10 hours in the Query Editor?

     

    So something like this.

    TodaysDate = DateTime.From(DateTimeZone.SwitchZone(DateTimeZone.FixedLocalNow(),-10))
    • OzcarHui07's avatar
      OzcarHui07
      Advocate I

      Hi GilbertQ


      Its perfect, thanks so very much, now i can show without problems.
      I resolved the them of UTC, also the zone time.

      although, only i have created a other column more of Date in the dimension time and it was asignated data type as Data / Time /TimeZone in the edit queries.

       

      Thanks.

  • jthomson's avatar
    jthomson
    Solution Sage

    OK, this is a bit of a bump from the past, but the problem in question ALMOST describes my problem perfectly. I too have a measure which is showing no results in the service, but is working perfectly in desktop, measure is this:

     

    var calculationdate = today()
    return CALCULATE(sum(PolicyData[GROSS_FEEAPPLIED]),PolicyData[ADJUSTMENTDATE]<=calculationdate)
     
    To best describe what is going on here, I've got a main report which has a slicer that's looking at a disconnected date table in order to display statistics at different points in time - it just uses selectedvalue on the date table, this works perfectly in both the service and desktop. Someone's asked for a simpler version of the report that's just showing the current position. I've replaced the working formula with a simple today(). Works in Desktop, in the service anything that is using this logic is blank. If this was a situation like Gilbert described where the service is running on UTC rather than what our local computers are on, that's fine, but:
     
    - I would still expect the measure to return everything before today's date, wherever in the world the service is based, and at most have +/- one day's worth of data erroneously
    - I'm in the UK, so I'm on UTC half the year anyway, and close enough to it the other half that I would never expect to see any timezone-related issues
     
    Is there a DAX command which will show today's date which actually works in the service? Is my use of a variable randomly causing an issue?