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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
waynewoodhead
Helper I
Helper I

daily rental earnings by date

Hi,

 

I have a rental data set and want to show earnings per day across all contracts.  The data looks like

ContractNoStartDateEndDateDaily Rate
1231/1/20205/1/20205
4564/1/20207/1/202010

 

What I want as an output is the summed daily rates for contracts active on each day 

 

1/1/20202/1/20203/1/20204/1/20205/1/20206/1/20207/1/2020

8/1/2020

55515151010

0

 

Any help appreciated,  thanks

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@waynewoodhead 

 

Create a calculated column seems to be more straightforward for you.

 

Column = CALCULATE(SUM('Table'[Daily Rate]),FILTER('Table',EARLIER('Calendar'[Date])>='Table'[StartDate]&&EARLIER('Calendar'[Date])<='Table'[EndDate]))

 

calendar column.JPG

https://qiuyunus-my.sharepoint.com/:u:/g/personal/paul_qiuyunus_onmicrosoft_com/Ef3pSJ337XdPpGkxVAg2...

 

Paul Zheng
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

5 REPLIES 5
V-pazhen-msft
Community Support
Community Support

@waynewoodhead 

 

Create a calculated column seems to be more straightforward for you.

 

Column = CALCULATE(SUM('Table'[Daily Rate]),FILTER('Table',EARLIER('Calendar'[Date])>='Table'[StartDate]&&EARLIER('Calendar'[Date])<='Table'[EndDate]))

 

calendar column.JPG

https://qiuyunus-my.sharepoint.com/:u:/g/personal/paul_qiuyunus_onmicrosoft_com/Ef3pSJ337XdPpGkxVAg2...

 

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

Greg_Deckler
Super User
Super User

You would need a date table to use in columns of the matrix. Unrelated.

You could then create a measure like this:
Measure =
VAR __Date = MAX('Calendar'[Date])
RETURN
SUMX(FILTER('Table',__Date >= [StartDate] && __Date <=[EndDate]),[Daily Rate])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg

I created the date table and added the measure to my data table.
When I put Date and Daily Rate into a view table the result is not correct.

Do I need to link the two tables first ?
Could you provide a sample PBIX ?
Much thanks
Wayne

Hi,

 

thanks,  I'm quite new to PBI so the help is great.

 

In which table do I create the Measure, Calendar or my data table, or elsewhere

 

Wayne

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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