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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors