Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Number of Containers Delivered (Daily):
Every day, only a limited number of containers can be delivered based on the available capacity.
Number of Containers Pending Delivery (Daily):
This is the number of containers that are still waiting to be delivered.
Total Containers (Daily):
This is the sum of:
Market | Date | Max eta date | No of containers arrived | Capacity | No of containers deliverd | pending | Total |
India | 11-11-2024 | 11-11-2024 | 23 | 5 | 5 | 18 | |
India | 12-11-2024 | 12-11-2024 | 24 | 5 | 5 | 37 | 42 |
India | 13-11-2024 | 5 | 5 | 32 | 37 | ||
India | 14-11-2024 | 5 | 5 | 27 | 32 | ||
India | 15-11-2024 | 5 | 5 | 22 | 27 | ||
India | 16-11-2024 | 5 | 5 | 17 | 22 | ||
India | 17-11-2024 | 5 | 5 | 12 | 17 | ||
India | 18-11-2024 | 5 | 5 | 7 | 12 | ||
India | 19-11-2024 | 5 | 5 | 2 | 7 | ||
India | 20-11-2024 | 20-11-2024 | 3 | 5 | 5 | 0 | 5 |
India | 21-11-2024 | 21-11-2024 | 5 | 5 | -5 | 0 | |
India | 22-11-2024 | 22-11-2024 | 5 | 5 | 5 | -5 | 0 |
India | 23-11-2024 | 23-11-2024 | 5 | 5 | -10 | -5 | |
India | 24-11-2024 | 24-11-2024 | 5 | 5 | -15 | -10 |
Hi @tkavitha911 , Thank you for reaching out to the Microsoft Community Forum.
Based on your description, I took some sample data and worked out the solution.
Please refer attached .pbix file for reference and share your thoughts.
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @tkavitha911 have split the logic into parts by creating intermediate calculated tables, please try this
first create a base weekday table
first table working fine but second table bit confusion about this WeekdayWithRowNumber
Hi @tkavitha911 this will just show row number, for looping purposes, like this
@tkavitha911 , Create measures using
// Calculate the total containers for each day
Total Containers =
VAR PreviousDayPending =
CALCULATE(
SUM('Table'[Pending]),
FILTER('Table', 'Table'[Date] = EARLIER('Table'[Date]) - 1)
)
RETURN
IF(
ISBLANK(PreviousDayPending),
'Table'[No of containers arrived],
PreviousDayPending + 'Table'[No of containers arrived]
)
// Calculate the number of containers delivered each day
No of Containers Delivered =
MIN('Table'[Capacity], 'Table'[Total Containers])
// Calculate the number of containers pending delivery each day
Pending =
'Table'[Total Containers] - 'Table'[No of Containers Delivered]
Create a calculated column for each metric:
Total Containers =
VAR PreviousDayPending =
CALCULATE(
SUM('Table'[Pending]),
FILTER('Table', 'Table'[Date] = EARLIER('Table'[Date]) - 1)
)
RETURN
IF(
ISBLANK(PreviousDayPending),
'Table'[No of containers arrived],
PreviousDayPending + 'Table'[No of containers arrived]
)
No of Containers Delivered =
MIN('Table'[Capacity], 'Table'[Total Containers])
Pending =
'Table'[Total Containers] - 'Table'[No of Containers Delivered]
Proud to be a Super User! |
|
Need calculated table for only week days
User | Count |
---|---|
17 | |
14 | |
13 | |
13 | |
11 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |