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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Dvilches_
Frequent Visitor

Count Operating Days

Hello there,

 

Hope you're doing great! I have a question. I'm using a simple model that const of two tables:

 

  1. FacSales
  2. DimCalendar

My company move several packages in a daily basis, however sometimes thare are some pendings shipmets that need to be done on saturdays.

 

My question is, how can i count operating days of a certain month based on packages quantities? For instance:

 

February:

Days: 28

Days with movements: 25 (this number i obtained using Distincount('FactSales'[Date]))

Ops Days: 20 (this is my objective discounting the days in which packages less than or equal to 15000 are moved. In other words I'm trying to get the business days as the days go by. I think doing it this way is better as it would detect the holidays )

 

As additional information, there is a threshold in terms of packages. On a Saturday they will never exceed 15,000 packages sent, while on weekdays this value exceeds 50,000 per day)

 

Thanks in advance,

 

Diego V.

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Dvilches_

 

count days if the day is greater then 15,000.

 

Count operating days = COUNTROWS(filter(SUMMARIZE('FacTable',[Date],"sum",SUM(FacTable[packages])),[sum]>15000)) 

 

Result:
vchenwuzmsft_1-1646718732616.png

Pbix file in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

View solution in original post

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @Dvilches_

 

count days if the day is greater then 15,000.

 

Count operating days = COUNTROWS(filter(SUMMARIZE('FacTable',[Date],"sum",SUM(FacTable[packages])),[sum]>15000)) 

 

Result:
vchenwuzmsft_1-1646718732616.png

Pbix file in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

You tha best! Working fine. Power Query i think that i handle it quite well, but currently i'm in the DAX journey.

 

Thanks for your time and this solution!

Syk
Super User
Super User

You could create a calculated column to look at your packages moved and if >15k set to true, else set to false.

Syk_0-1646320859492.png

Then you could use it to filter your data by setting it to true. Or you could create a measure to count days where it is true. Depends what you need it for!

Dvilches_
Frequent Visitor

Hey Syk,

 

That would be useful if you grouped the data, but i would lose granularity.. In this case the data comes for shiptment ID. In average, each shipmet have 1-3 packages.

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors