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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.

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



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors