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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
neil_floyd
Regular Visitor

Help to apply cash book logic to inventory level

Hi!

I work at a company that lends products for sales representaives that eventually return the products.
So I am building a report which should display the current product quantity that each representative has in its hands.

Here is a  simplifield example of my fact table:

product_loan:

quantityloan_datereturn_date
501/jan/202315/jan/2023
1005/jan/202320/jan/2023
320/jan/2023 

 

I would like to be able to plot a chart like this, which display the current quantity not returned in each date (I have a Date Dimension Table):

neil_floyd_0-1675461613109.png


What I want to achieve seems to be similar to a cash book logic, with debt, credit and balance for each day.

I am struggling with this because I have a Date dimension table, but I am not able to create a relationship with both loan_date and return_date at the same time. Also, I am not sure if this "current quantity not returned" should be a calculated  measure or if I should create calculated table instead to support this calculation.


I would appreciate any help.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @neil_floyd ,

Please refer to my pbix file to see if it helps you.

Add a custom column.

List.Transform(try {Number.From([loan date])..Number.From([return date])} otherwise {Number.From([loan date])..Number.From(Date.EndOfMonth([loan date]))} ,each Date.From(_))

Then create a measure.

Measure = CALCULATE(SUM('Table'[quantity]),FILTER(ALL('Table'),'Table'[Custom]=SELECTEDVALUE('Table'[Custom])))

vpollymsft_0-1675651872552.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

2 REPLIES 2
Anonymous
Not applicable

Hi @neil_floyd ,

Please refer to my pbix file to see if it helps you.

Add a custom column.

List.Transform(try {Number.From([loan date])..Number.From([return date])} otherwise {Number.From([loan date])..Number.From(Date.EndOfMonth([loan date]))} ,each Date.From(_))

Then create a measure.

Measure = CALCULATE(SUM('Table'[quantity]),FILTER(ALL('Table'),'Table'[Custom]=SELECTEDVALUE('Table'[Custom])))

vpollymsft_0-1675651872552.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

amitchandak
Super User
Super User

@neil_floyd , refer

Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM

 

Use a date table

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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