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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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
Super User
Super User

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
Super User
Super User

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors