Forum Discussion

想要多多的赚钱's avatar
想要多多的赚钱
Frequent Visitor
2 months ago
Solved

Service Date

May I ask you a question? I have a report and customized a date table with a deadline of Today(). However, after refreshing the model every day on the Power BI service, the current date cannot be displayed. When I downloaded the report locally and viewed the data in the date table, the current date was displayed. Is this due to a time zone issue on the service? At first, I thought it was a time zone problem on the service, so I modified the code online to TODAY()+TIME (8,0,0), but the situation was still the same the next day. Have you encountered similar problems before?

There is no current date on the Service page

Download the report locally with the current date

 

  • 想要多多的赚钱 Please try using a Measure instead of a calculated column/table where possible:

    1. Today Local = DATEVALUE(TODAY())   // or adjust with UTC conversion if needed
      Measures evaluate at query time (when visuals render), which can be more dynamic. However, for a full date table (especially for relationships/slicers), you often need a static table.

    If you really need to do it in a table, please try to handle Time Zone properly in the Date Table:

    • Create/adjust your date table using Power Query (M) for better control during refresh.

    • Use DateTimeZone.UtcNow() + explicit conversion to your local time zone.

    • Example in Power Query (for a custom column or to generate dates):

      // Get current UTC and convert to your time zone (example: UTC+8)
      CurrentUTC = DateTimeZone.UtcNow(),
      CurrentLocal = DateTimeZone.SwitchZone(CurrentUTC, 8, 0),  // Adjust offset for your zone
      TodayLocal = Date.From(CurrentLocal)
       
      For a full date table that includes "today" dynamically, many people generate a range around the refresh date and mark the current day with a flag column.
  • Power BI Service uses UTC. Use UTCNOW then convert it to the local timezone. Try:

    VAR _offset = 8
    
    RETURN
        DATEVALUE (
            UTCNOW() + DIVIDE ( _offset, 24 )
        )

5 Replies

  • 想要多多的赚钱 Please try using a Measure instead of a calculated column/table where possible:

    1. Today Local = DATEVALUE(TODAY())   // or adjust with UTC conversion if needed
      Measures evaluate at query time (when visuals render), which can be more dynamic. However, for a full date table (especially for relationships/slicers), you often need a static table.

    If you really need to do it in a table, please try to handle Time Zone properly in the Date Table:

    • Create/adjust your date table using Power Query (M) for better control during refresh.

    • Use DateTimeZone.UtcNow() + explicit conversion to your local time zone.

    • Example in Power Query (for a custom column or to generate dates):

      // Get current UTC and convert to your time zone (example: UTC+8)
      CurrentUTC = DateTimeZone.UtcNow(),
      CurrentLocal = DateTimeZone.SwitchZone(CurrentUTC, 8, 0),  // Adjust offset for your zone
      TodayLocal = Date.From(CurrentLocal)
       
      For a full date table that includes "today" dynamically, many people generate a range around the refresh date and mark the current day with a flag column.
    • 想要多多的赚钱's avatar
      想要多多的赚钱
      Frequent Visitor

      Thank you. I had trying to build a calendar using Power Query, and I will see if the issue has been resolved

      • danextian's avatar
        danextian
        Icon for Super User rankSuper User

        If you're trying to build in PowerQuery, UTCNOW() is a DAX function so it wont work. Try this:

        let
            DateToday = Date.From(DateTime.From(DateTimeZone.RemoveZone(DateTimeZone.UtcNow()) + #duration(0,8,0,0))),
            Dates = let 
        StartDate = #date(2020, 1, 1 ),
        Count = Number.From(DateToday) - Number.From(StartDate),
        Dates = List.Dates(StartDate, Count, #duration(1,0,0,0))
        
        in Table.FromColumns({Dates}, {"Date"}),
            #"Inserted Month Name" = Table.AddColumn(Dates, "Month Short", each Text.Start(Date.MonthName([Date]), 3), type text),
            #"Inserted Month Name1" = Table.AddColumn(#"Inserted Month Name", "Month Long", each Date.MonthName([Date]), type text),
            #"Inserted Month" = Table.AddColumn(#"Inserted Month Name1", "Month Number", each Date.Month([Date]), Int64.Type),
            #"Inserted Year" = Table.AddColumn(#"Inserted Month", "Calendar Year", each Date.Year([Date]), Int64.Type)
        in
            #"Inserted Year"
  • Power BI Service uses UTC. Use UTCNOW then convert it to the local timezone. Try:

    VAR _offset = 8
    
    RETURN
        DATEVALUE (
            UTCNOW() + DIVIDE ( _offset, 24 )
        )
    • 想要多多的赚钱's avatar
      想要多多的赚钱
      Frequent Visitor

      Thank you. I am trying to build a calendar using Power Query, and I will see if the issue has been resolved