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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MichelleRoberts
Regular Visitor

Count The Number Of Days In a Dataset

Hello!

 

I have a report that looks at the total number of parts produced by each of our work cells by date. I have the report filtered to the last calendar month. I need a way to come up with a count for the total number of days. Since we do not run 7 days a week and we do not run on holidays, it's not the total number of days in the month. We also have days where we shut down the plant that are not holidays. So for example, in the screenshot below, I need something that will say there are 26 days in this report's range.

 

MichelleRoberts_0-1709573635348.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @MichelleRoberts 

Thanks @SivaMani . Have you solved your problem? I read your previous reply, you can create a DAX expression similar to the following:

First, you can create a measure based on the current Table Visual, as shown in the following image:

vjianpengmsft_2-1711021958931.png

Use a DAX expression similar to the following:

vjianpengmsft_3-1711022052329.png

vjianpengmsft_4-1711022100139.png

Here are the results:

vjianpengmsft_5-1711022133252.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

12 REPLIES 12
SivaMani
Resident Rockstar
Resident Rockstar

@MichelleRoberts , Create a measure 

 

Count of days = DISTINCTCOUNT(<Date Column>)

 

 

If I do that, get the following result:

 

If it's summed:

MichelleRoberts_2-1709578925467.png

 

 

If I don't sum it:

MichelleRoberts_3-1709578932407.png

 

@MichelleRoberts , Can you try DISTINCTCOUNT () in a measure (refer the updated syntax in my previous reply) ?

 

 

I did and got the same exact results.

Can you remove .[Date] from your calculation?

 

I removed the .[Date] and got this result:

MichelleRoberts_0-1709581046492.png

 

@MichelleRoberts ,Is there any filter applied in the report and if no filter is applied what should this measure show?

The only filter is that the transaction date is in February. I want it to return the number 26 since there were 26 days where we had transactions in the month of February. Does that make sense?

Where is the Transaction Date = February applied? Is the filter applied at the visual level? If yes, it won't carry the filter to other visuals. You may need to add it as a slicer and apply the filter.

It's applied at the page level but I'm not concerned about that right now. I just need to find a formula that will tell me 26 for 26 total transaction days in February.

I got the count to work as it should but now I need a formula to take the 26 and divide the qty to get how many parts per day. The issue is that I want each area to be divided by 26 but because some areas didn't have a shipment in every day, it wants to divide by the number of days where there were transactions in that area. Do you know how that can be accomplished? 

MichelleRoberts_0-1709647513580.png

 

Anonymous
Not applicable

Hi, @MichelleRoberts 

Thanks @SivaMani . Have you solved your problem? I read your previous reply, you can create a DAX expression similar to the following:

First, you can create a measure based on the current Table Visual, as shown in the following image:

vjianpengmsft_2-1711021958931.png

Use a DAX expression similar to the following:

vjianpengmsft_3-1711022052329.png

vjianpengmsft_4-1711022100139.png

Here are the results:

vjianpengmsft_5-1711022133252.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.