Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Zakhamido
Frequent Visitor

Incorrect Calculated Column Value

Hi Guys I need your help, I have 2 columns that was created in power query with formulas. The first column was to calculate the duration of opened cases by minutes using the following code Duration in Minutes = Duration.TotalMinutes(DateTime.LocalNow() - [Creation Date]) and then the second column to return the value yes or no based on the open time of the cases with the following code if [Case Type]="Water Emergency" and [Duration in Minutes]>=180
then "Yes"
else if [Case Type]="Unknown Water Customer Complaint" and [Duration in Minutes]>=180
then "Yes"
else if [Case Type]="Electricity Emergency" and [Duration in Minutes]>=120
then "Yes"
else if [Case Type]="Unknown Electricity Customer Complaint" and [Duration in Minutes]>=120
then "Yes"
else "No"

 

and then I created cards and slicers to return the number of cases that exceeded SLA and all is good and getting the correct number in power bi desktop. However, after I publish the report it will show the SLA cases number correct until the first refresh of the data and then I will keep on getting a number that does not match the exact same file on the power bi Desktop and below is a sample of the difference in numbers and I made sure that all the filters were cleared and data was refreshed and the same in both files 

 

Zakhamido_0-1690465671353.png

In Power Bi Desktop 

Zakhamido_1-1690465756582.png

Published Report 

 

I tried every thing and couldn't find a solution, I even dowloaded the published file and when opening it on desktop it will show the correct number

1 ACCEPTED SOLUTION
blopez11
Super User
Super User

It is likely because in the Power BI service datetime.localnow returns the date/time in UTC, which you should be able to validate.

View solution in original post

3 REPLIES 3
blopez11
Super User
Super User

It is likely because in the Power BI service datetime.localnow returns the date/time in UTC, which you should be able to validate.

thank you so much!!
Instead of using DateTime.LocalNow(), I had to use DateTimeZone.UtcNow() + TIME(4,0,0) 

Thaaaanks Man , you are a legend 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.