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
Anonymous
Not applicable

Calculate previous business day transactions excluding holidays and weekends

I am currently trying to calculate the number of transations on the previous business date. I have found a way to create the calucation to ignore weekends but I am unsure how to have it also ignor weekends.

 

this is my current formula:

 

Orders Previous Day =
CALCULATE (
COUNT ( 'Transactions '[ORDER_ID] ),
'Transactions '[CUR_ORDER_STATUS_CD] = "CLOSED",
IF (
(
FORMAT ( 'Calendar'[Date] = TODAY (), "dddd" ) = "Monday"
),
'Calendar'[Date]
= TODAY () - 3,
'Calendar'[Date]
= TODAY () - 1
) ,
4 REPLIES 4
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

I am confused about your formula. I create a measure to exclude weekends and cound ID.

WEEKDAY = WEEKDAY('Calendar'[Date],2)

Measure = 
CALCULATE (
COUNT ( Transactions[ORDER_ID] ),FILTER(Transactions,Transactions[CUR_ORDER_STATUS_CD] = "CLOSED"  &&
MAX('Calendar'[WEEKDAY]) <> 6  && MAX('Calendar'[WEEKDAY]) <>7))

6.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

hi @v-xuding-msft ,

 

this FORMAT ( 'Calendar'[Date] = TODAY (), "dddd" ) is changng the date into day names (like monday, tuesday, wednesday, etc.). When the current date is a Monday subtract  by 3 otherwise subtract by 1. My dashboard will not used on the weekend so i am not concerned about adding in the other sitations.

 

I like the way you used the filters on the date. Do you have to exclude for weekends as well?

Hi @Anonymous ,

I exclude weekends through the weekday isn't equal 6 and 7. You could post some sample data and expected result that we can understand your requirement clearly.

How to Get Your Question Answered Quickly

 

I attached my sample that maybe can help you a little bit.

 

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Do you have a way to exclude holidays as well?

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.