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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Edgarb
New Member

Count Number of Days in a Range of Days over Multiple Rows

I want to count the number of days an object is in use.  I want to count both the departure and return dates in the calcution. However, in some cases the object is returned on the same day it departs again.


I don't want to double count the days the object is in use in these situations.  Is there a formula I'm able to use with DAX?

 

Below is a table with an example.  I don't want to count March 15th twice

Departure DateReturn DateDays in UseDesired Result
March 11March 1222
March 13March 1533
March 15March 1843
Total 98
1 ACCEPTED SOLUTION
pmreis
Most Valuable Professional
Most Valuable Professional

Hi @Edgarb 

You can solve this easily with Power BI Visual Calculations. 
pmreis_0-1710179096468.png

 

Here is the file with the solution: PBI_Problem_Solving/Count Number of Days in a Range of Days over Multiple Rows.pbix at main · pedror...


A few notes for this to work:

  • Make sure you have updated Power BI to the latest version
  • On Options, activate the preview feature "Visual Calculations" and restart Power BI.

Reference: Using visual calculations in Power BI Desktop - Power BI | Microsoft Learn


Pedro Reis - Data Platform MVP / MCT
Making Power BI and Fabric Simple

If my response resolved your issue, please mark it as a solution to help others find it. If you found it helpful, please consider giving it a kudos. Your feedback is highly appreciated!

Find me at LinkedIn


PBIX file here:

 

View solution in original post

1 REPLY 1
pmreis
Most Valuable Professional
Most Valuable Professional

Hi @Edgarb 

You can solve this easily with Power BI Visual Calculations. 
pmreis_0-1710179096468.png

 

Here is the file with the solution: PBI_Problem_Solving/Count Number of Days in a Range of Days over Multiple Rows.pbix at main · pedror...


A few notes for this to work:

  • Make sure you have updated Power BI to the latest version
  • On Options, activate the preview feature "Visual Calculations" and restart Power BI.

Reference: Using visual calculations in Power BI Desktop - Power BI | Microsoft Learn


Pedro Reis - Data Platform MVP / MCT
Making Power BI and Fabric Simple

If my response resolved your issue, please mark it as a solution to help others find it. If you found it helpful, please consider giving it a kudos. Your feedback is highly appreciated!

Find me at LinkedIn


PBIX file here:

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors