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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

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
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.