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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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