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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
sstewarta
Frequent Visitor

In the desktop, the date logic is right, but not in the service.

Hello all,

 

I've created a table that is based on a Microsoft Exchange calendar. I'm having trouble getting a day offset based on a column on column, but only if my user scheduled column has a value. It is offsetting based on the exchange calendar date. My DAX logic is a little weird, but the problem is that it works well on the desktop. However, after I publish it, the date is pushed back an extra day or two. I'm stumped as to why this is. What are your thoughts on this?

 

DNE Date = 
var PrevDay = 'Schedule Calendar'[Start].[Date] - 1 -- **DNE date is always one day before the start date that somone works it.**
Var NewDay1 = IF( FORMAT(PrevDay,"DDD") = "Sat", PrevDay-1, 
        IF( FORMAT( PrevDay,"DDD") = "Sun", PrevDay-2, 
        PrevDay)
        ) -- **for testing if PrevDay is a weekend.**
Var Holi = IF( CALCULATE( MAX('Schedule Calendar'[User Scheduled]), FILTER('Schedule Calendar', NewDay1 = 'Schedule Calendar'[Start])) = "", NewDay1 -1, NewDay1) -- **for is there what no one seduled, mostly holidays.**
Var NewDay2 = IF( FORMAT(Holi,"DDD") = "Sat", Holi-1, 
        IF( FORMAT( Holi,"DDD") = "Sun", Holi-2, 
        Holi)
        ) -- **for if day after Holi is weekend.**

return IF( 'Schedule Calendar'[User Scheduled] = "", BLANK(),
            IF('Schedule Calendar'[Start] = DATE(2022,2,17), DATE(2022,2,16), -- **2nd if added for earliest date in start, 'Holi' logic does not work for the first date and returns with extra day. this is a one off.**
                 NewDay2)) 
2 REPLIES 2
sstewarta
Frequent Visitor

@ribisht17  I'm in Central Time, not UTC Time, so they won't match. How does this matter because none of the calculations take into account time, only the date?

ribisht17
Super User
Super User

@sstewarta 

 

Are desktop and Server time zones same or not?

Solved: changing timezone of powerbi service? - Microsoft Power BI Community

 

Regards,

Ritesh

Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.