cancel
Showing results for
Did you mean:
Regular Visitor

## Date calculating differently on desktop and web due to formatting

I have a measure which calculates the number of working days within the current month (up to yesterday) with the following calculation:

Working Days = CALCULATE(SUM(Holidays[Working Day]), FILTER(Holidays, Holidays[Date] >= ([First date in slicer])),
FILTER(Holidays, Holidays[Date] <= [Latest Date in slicer]))

The Holiday's DB is stored online and has 3 columns, Day (this is a text field for an explanation of why a week day isn't a working day e.g. Christmas day etc.), Date (formatted in UK format) and Working Day (either 1 or 0) whereby 1 is a working day and 0 isn't.

The first date in slicer is the first of the current month: DATE(YEAR(TODAY()), MONTH(TODAY() -1), 1)

The latest date in slicer is yesterday (as we run the report for the last full day which will always be the day before it's ran: TODAY() - 1

When I run it in Power BI desktop, I get working days as 4. When I upload it and run it on Power BI Online, I get working days as 5. This then impacts a whole table as the table is divded by the number of working days.

Can anyone help? I have changed the Power BI online language settings to be default already and that has updated the date formats on the slicers from US to UK but it is still saying 5 working days and not 4.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

## Re: Date calculating differently on desktop and web due to formatting

HI @aimsc,

First, if you direct use number to calculate with date, calculate time unit is days.

Second, utctoday not contains time part, so I think you can use utcnow.

Finally, BST timezone is utc +1, I think you should use + 1 hour instead -1.

```First date in slicer =
VAR bst =
UTCNOW () + TIME ( 1, 0, 0 )
RETURN
DATE ( YEAR ( bst ), MONTH ( bst ), 1 )

Latest Date in slicer =
UTCTODAY () + TIME ( 1, 0, 0 )
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
8 REPLIES 8
Super User IV

## Re: Date calculating differently on desktop and web due to formatting

Is this in a dashboard tile or in a report that you see the 5?

---------------------------------------

Not the Power BI thought police...

##### I have NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Datanaut!

Highlighted
Regular Visitor

## Re: Date calculating differently on desktop and web due to formatting

Hi @Greg_Deckler I put it in a card on a report to view the number in both Desktop and Online.

I know it's wrong because when I manually calculate the average, it is using 5 and not 4 e.g. it is doing 964 / 5 to get 193 rather than 964 / 4 to get 241.

Community Support

## Re: Date calculating differently on desktop and web due to formatting

HI @aimsc,

AFAIK, current power bi service will analysis datetime as UTC format.

For UTC datetime, it equal to zero timezone datetime, it is different as local datetime. I think your issue is related to it.

Time in PBI Service is inconsistent with the local time (non-UTC time) displayed in PBI Desktop

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Regular Visitor

## Re: Date calculating differently on desktop and web due to formatting

I made the change as suggested, using +1 as I'm in BST, however, that now makes the desktop version incorrect too and today they are dividing by 6 working days rather than 5.

Community Support

## Re: Date calculating differently on desktop and web due to formatting

HI @aimsc,

I'd like to suggest you use UTCNOW and UTCTODAY function to use UTC format to deal with you records.

Power BI Desktop February Feature Summary

Spoiler

## UTCNOW() and UTCTODAY()

We've added two new DAX functions this month that help if you're working with date-time data across timezones. DAX has long supported the NOW() and TODAY() functions that return time and date in the timezone that the function's being used - so if a .pbix file is passed to someone in a different timezone they'll see different results. UTCNOW() and UTCTODAY() will always return the current time or date in UTC so you can guarantee consistent results wherever you are (and also when you upload the workbook to the Power BI service).

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Regular Visitor

## Re: Date calculating differently on desktop and web due to formatting

Hi @v-shex-msft

I updated the following and it still has 6 working days:

First date in slicer = DATE(YEAR(UTCTODAY()), MONTH(UTCTODAY() -1), 1)

Latest Date in slicer = UTCTODAY() - 1

Many thanks,

Aimee

Community Support

## Re: Date calculating differently on desktop and web due to formatting

HI @aimsc,

First, if you direct use number to calculate with date, calculate time unit is days.

Second, utctoday not contains time part, so I think you can use utcnow.

Finally, BST timezone is utc +1, I think you should use + 1 hour instead -1.

```First date in slicer =
VAR bst =
UTCNOW () + TIME ( 1, 0, 0 )
RETURN
DATE ( YEAR ( bst ), MONTH ( bst ), 1 )

Latest Date in slicer =
UTCTODAY () + TIME ( 1, 0, 0 )
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Regular Visitor

## Re: Date calculating differently on desktop and web due to formatting

Thanks @v-shex-msft that worked but with the -1 hour.

Thanks so much!!

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

#### Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

#### Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors