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
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
v-rongtiep-msft
Community Support
Community Support

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
v-rongtiep-msft
Community Support
Community Support

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

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.

Top Solution Authors