cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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.

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
Community Support

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.
4 REPLIES 4
Community Support

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.
Helper V

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!!!

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

Thank you!!!!

Helper V

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

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

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors