Dynamic Positional Inventory
Hi,
I am looking to create a pivot table that is able to handle positional inventory dynamically.
For example, if I have 3 weeks in my filtered range, I want to only show the data on the last week.
I am using the below.
CASE
WHEN Week ending date
= MAX(Week ending date
) OVER ()
THEN SUM(ifnull(EOH Qty
,0))
ELSE 0
END
This works if I have all my dimensions in the pivot table.
When I remove elements or weeks I get errors although the totals are correct,
The totals are still correct and even the line level is okay but I am still seeing ### in one row.
If I am only showing store level totals are correct but it isn't summing the values by store.
Anyone ever try to do this?
Answers
-
This is the supporting dataset
0 -
With that OVER() clause in your CASE statement, it's producing a value for each week that can't be combined. If you have the week as part of the Row/Column definition, then you're fine. If you don't, then there are collisions.
The way your function is written will always give 0s to everything besides this week, so is there a reason to include past weeks in the card? If not, you could filter the table for just this week, which will prevent the collisions. A dynamic filter BeastMode could look like this:
CASE
WHENWeek ending date
= MAX(Week ending date
) OVER () then 'Include'
else 'Exclude'
END(Card filter Include)
Otherwise, you'll need to approach your BOH and EOH functions differently, so that they are able to aggregate across weeks and not create collisions.
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
Yes so I will also have sales in my dataset and I will need to create calculations for available which will take my full month's sales and add them to the ending position of the month.
The table will look like the below
0 -
It's really hard to get partition or fixed functions to play well with a Pivot Table. You could create something that checks against an input variable, where the user can input which week they want to calculate BOH with (less automatic then what you were exploring):
case
whenWeek ending date
>= date(Date Input Variable
) thenBOH Qty
else 0
end(Choose the SUM aggregation after bringing it into the value).
—
If your data is updated daily/weekly, you could maybe do something more dynamic with CURRDATE:
case
when
Week ending date
>= CURRDATE() - 7 thenBOH Qty
else 0
end
— Not sure about that -7, depending on your update cadence.
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
Thank you, if I created a date variable to select the proper week ending date of the timeframe how would the bestmode look to make it usable?
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 310 Workbench
- 7 Cloud Amplifier
- 9 Federated
- 3K Transform
- 114 SQL DataFlows
- 654 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 796 Beast Mode
- 78 App Studio
- 44 Variables
- 757 Automate
- 188 Apps
- 480 APIs & Domo Developer
- 72 Workflows
- 17 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 408 Distribute
- 119 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 141 Manage
- 137 Governance & Security
- 8 Domo Community Gallery
- 47 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive