cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sy898661
Helper V
Helper V

Show total decrease over time

Hi all,

 

I have a question on how to create a certain visual.

 

So I have data that looks like this,

And what I want to show is TOTAL ON HAND QTY as time passes... Basically subtract the on hand qty from the total after the ship date has passed.

So currently, it is 1208.

On March 1st, it should be 955.

 

Capture.PNG

 

My issue is that since everything is tied to ship date weekly bins, it wont show Total Qty each week, it just shows Total Qty for whatever products are being shipped. 

 

How would I create a measure or column that will allow this?

 

Thanks!!!!

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@sy898661 

 

You may try the measure below.

Measure =
VAR w =
    CALCULATE ( MAX ( 'Table'[Week] ), ALLSELECTED ( 'Table'[Item] ) )
VAR i =
    SELECTEDVALUE ( 'Table'[Item] )
RETURN
    SUMX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Item] = i && 'Table'[Week] > w ),
        'Table'[Qty]
    )

 

Community Support Team _ Sam Zha
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

4 REPLIES 4
v-chuncz-msft
Community Support
Community Support

@sy898661 

 

You may try the measure below.

Measure =
VAR w =
    CALCULATE ( MAX ( 'Table'[Week] ), ALLSELECTED ( 'Table'[Item] ) )
VAR i =
    SELECTEDVALUE ( 'Table'[Item] )
RETURN
    SUMX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Item] = i && 'Table'[Week] > w ),
        'Table'[Qty]
    )

 

Community Support Team _ Sam Zha
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

Hey @v-chuncz-msft 

 

So in the code you created (beautifully done), we said as the Ship Date passes/goes in the past, subtract that on-hand qty amount from total amount (total amount = sum of all on hand).

 

We have since added more data and a new column that is Planned Start Date in order to have a more accurate view of "Current" on-hand total, since before we just assumed all of the On-Hand qty has already been made/we already have it.

 

Adding in the new data, we realized we were wrong, and we do Not currently have all of the "on-hand" inventory.

 

I was wondering (if possible) how I could adjust the code to say the following:

 

If Planned Start Date is in the past, Use as starting On-Hand qty (lets call it TOTAL qty)

If Planned Start Date is in the future, add on-hand qty to TOTAL qty

If Ship Date is in the past, subtract from TOTAL qty

 

please let me know if this is too big of an ask, or if you need more info to clarify! either way I really appreciate all of your help.

 

I tried to build on the example I originally posted to give more context but it might be more confusing idk lol!!!

Capture.PNG

https://drive.google.com/file/d/1e--PjJHbpJbuYFDvaU2c-NmMRicrf29o/view?usp=sharing

^google drive link for the excel file so you can see it better 

 

Thank you!!!!

Ah! That worked perfectly!!!! Thank you so so much!

Greg_Deckler
Super User
Super User

Post text data and it will make it easier to get you a 100% solution. I wrote a Days of Supply measure that seems to probably be along the lines of what you want. https://community.powerbi.com/t5/Quick-Measures-Gallery/Days-of-Supply/m-p/635656#M318


@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop! Microsoft Hates Greg's Quick Measures
YouTube Channel! Microsoft Hates Greg
Check out my latest book!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.