Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Okay Guys, I have read about 50 posts on this topic and have tried to get a variety of formulas to work, but have been unable to make it work. I am trying to determine the days between open and close of a service ticket excluding weekends. Essentially days to resolution.
Objective: Ticket opened - Ticket Closed & filter out weekends (we can worry about Holidays later).
I can get this to give me output on days between calls:
I have created a date table and created the following switch:
is work day = SWITCH(WEEKDAY([Date]),1,0,7,0,1)
Solved! Go to Solution.
Hi @PowerBInewb,
Try to use the following calculated column:
WorkingDays = Tickets[CloseDate] - Tickets[OpenDate] - SUMX( FILTER(DimDate; DimDate[Date] > Tickets[OpenDate] && DimDate[Date] < Tickets[CloseDate]); IF(WEEKDAY(DimDate[Date]) = 1 || WEEKDAY(DimDate[Date]) = 7; 1; 0) ) + 1
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @PowerBInewb,
Try to use the following calculated column:
WorkingDays = Tickets[CloseDate] - Tickets[OpenDate] - SUMX( FILTER(DimDate; DimDate[Date] > Tickets[OpenDate] && DimDate[Date] < Tickets[CloseDate]); IF(WEEKDAY(DimDate[Date]) = 1 || WEEKDAY(DimDate[Date]) = 7; 1; 0) ) + 1
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCan this be represented in hours?
I made a new copy of my dashboard and took it out of Direct Query. Sumx worked without issue. The results were interesting. Instead of showing the difference in days excluding the weekend it gave me the following screenshots. Basically a random date. I just want the total number of days that passed from open to close.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThat did the trick. Converting that column to a whole number! Thank you so much!
I did have to remove the +1 at the end of the formula. I want 0 days to = a same day repair in my pie charts, and that +1 I think will mess that up.
Awesome! Now I just need to fill in the holidays and preferably keep it Direct Query.
Hi @PowerBInewb,
Try the following two measure for the direct query:
WorkingDays measure = DATEDIFF(max(Tickets[OpenDate]); MAX(Tickets[CloseDate]);DAY) - SUMX( FILTER(DimDate; DimDate[Date] > MAX(Tickets[OpenDate]) && DimDate[Date] < MAX(Tickets[CloseDate])); IF(WEEKDAY(DimDate[Date]) = 1 || WEEKDAY(DimDate[Date]) = 7; 1; 0) ) Working days total = IF ( HASONEFILTER ( Tickets[Ticket] ); [WorkingDays measure]; SUMX ( ALLSELECTED ( Tickets[Ticket] ); [WorkingDays measure] ) )
The first measure is the calculation however when you place it on a table it will give a strange total, if you want to have the sum of the working days on projects use the second measure on the table visual.
Should work as intended, be aware that this calculation is based on the max and values of date so based on row level context.
Regards,
MFelix
Hi @PowerBInewb,
Try the following two measure for the direct query:
WorkingDays measure = DATEDIFF(max(Tickets[OpenDate]); MAX(Tickets[CloseDate]);DAY) - SUMX( FILTER(DimDate; DimDate[Date] > MAX(Tickets[OpenDate]) && DimDate[Date] < MAX(Tickets[CloseDate])); IF(WEEKDAY(DimDate[Date]) = 1 || WEEKDAY(DimDate[Date]) = 7; 1; 0) ) Working days total = IF ( HASONEFILTER ( Tickets[Ticket] ); [WorkingDays measure]; SUMX ( ALLSELECTED ( Tickets[Ticket] ); [WorkingDays measure] ) )
The first measure is the calculation however when you place it on a table it will give a strange total, if you want to have the sum of the working days on projects use the second measure on the table visual.
Should work as intended, be aware that this calculation is based on the max and values of date so based on row level context.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsRoger that, measures are inputted.
The first measure seems to work, but after I insert the second one into the table, PowerBI just spins its wheel (literally). 5 minutes without any addition to the table to show the result. Eventually this error comes up:
"The operation was cancelled bcause of locking conflicts."
An additional question:
Working days total = IF ( HASONEFILTER ( Tickets[Ticket] ); [WorkingDays measure]; SUMX ( ALLSELECTED ( Tickets[Ticket] ); [WorkingDays measure] ) )
By tickets are you refering to my "callnumber" column?
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsOkay one more update. I removed all the semi-colons from your original formula. Now I am getting an error about sumx not being allowed in direct query mode. I'd like to keep it direct if possible. I am allowing unrestricted measures in DQ.
@MFelixThank you so much for getting back to me. I went ahead and changed the naming of my dim table to how you laid out in the example for sake of simplicity.
Upon copying it in and putting my appropriate fields in place I am getting a dax error. Please see the attached image.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |