Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, firstly I'll leave some example data:
package_ID | client_ID | package_weight | due_date | arrival_date |
1 | 1 | 20 | 03-03-2021 | 05-03-2021 |
2 | 1 | 15 | 08-04-2021 | 02-04-2021 |
3 | 2 | 18 | 08-03-2021 | 12-03-2021 |
4 | 3 | 23 | 05-03-2021 | 03-03-2021 |
5 | 1 | 35 | 20-05-2021 | |
6 | 3 | 12 | 10-04-2021 | 31-03-2021 |
7 | 2 | 8 | 13-04-2021 | 20-04-2021 |
8 | 3 | 33 | 08-06-2021 | |
9 | 1 | 26 | 10-06-2021 | |
10 | 2 | 14 | 09-06-2021 | |
11 | 2 | 60 | 08-07-2021 | |
12 | 3 | 32 | 15-07-2021 | |
13 | 1 | 4 | 20-07-2021 |
Just in case, dates are D-M-Y. The example data assumes a current date of 25-04-2021. Some dates in the arrival_date column are intentionally blank, since those are due in the future. Those are filled in as the packages arrive.
What I need to achieve is a line graph that has three elements:
1) Running total for package_weight by due_date.
2) Running total for package_weight by arrival_date.
3) A simple projection for total package_weight based on a simple estimate. Something like this: first calculating a "daily weight" for last "interval", ie. last package_weight divided by days between penultimate arrival_date and last arrival_date, and then multiplied by amount of days until a given date, eg. 31-07-2021. That should give a very simple projection for the period from last arrival_date to 31-07-2021.
All of this per client. This is, I need to be able to use a slicer to view the data corresponding to a single client.
An example graph of what I want to achieve here:
In the graph blue is running total of package_weight by due_date, orange is running total of package_weightby arrival_date, and red is the projection.
Also, apparently the forecast functionality is of no help in this case because the dates are not at regular intervals.
Any help is appreciated!
Solved! Go to Solution.
@DusanVH ,with help from a date table which joined to both dates assume due date join is inactive try measure like
Cumm arrival= CALCULATE(SUM(Table[package_weight]),filter(allselected(date),date[date] <=max(date[Date])))
Cumm due = CALCULATE(CALCULATE(SUM(Table[package_weight]), userelationship(date[date],table[due_date]) ),filter(allselected(date),date[date] <=max(date[Date])))
if needed add filter for not(isblank([arrival date])) or not(isblank([due date])) in respective formula
@DusanVH ,with help from a date table which joined to both dates assume due date join is inactive try measure like
Cumm arrival= CALCULATE(SUM(Table[package_weight]),filter(allselected(date),date[date] <=max(date[Date])))
Cumm due = CALCULATE(CALCULATE(SUM(Table[package_weight]), userelationship(date[date],table[due_date]) ),filter(allselected(date),date[date] <=max(date[Date])))
if needed add filter for not(isblank([arrival date])) or not(isblank([due date])) in respective formula
Sorry for the late follow-up.
Your suggestion worked for me, although with a change:
Cumm due = CALCULATE(CALCULATE(SUM(Table[package_weight]), USERELATIONSHIP(date[date], table[due_date])), FILTER(ALLSELECTED(table[due_date]), ISONORAFTER(table[due_date], MAX(table[due_date]), DESC)))
Cumm arrival = CALCULATE(CALCULATE(SUM(Table[package_weight]), USERELATIONSHIP(date[date], table[arrival_date]), FILTER(ALLSELECTED(table[arrival_date]), ISONORAFTER(table[arrival_date], MAX(table[arrival_date]), DESC)))
Blue is Cumm due and cyan is Cumm arrival. Only Cumm due seems to work.
This is also using due_date as the graph's x axis (Axis box). When I put arrival_date there, it's reversed, Cumm arrival works and Cumm due doesn't. It's kinda obvious it should'nt work, as I should use the date[date] instead, but when I do, the table is empty. I imagine this is due to me not using the dates table in my code. I also used different code because if I used the exact one you provided, the Cumm arrival line went to a constant 100, the arrival date points started at the first date of my Dates table to the last one, and there was one arrival date point for each day, like so:
I'm also missing the projection:
3) A simple projection for total package_weight based on a simple estimate. Something like this: first calculating a "daily weight" for last "interval", ie. last package_weight divided by days between penultimate arrival_date and last arrival_date, and then multiplied by amount of days until a given date, eg. 31-07-2021. That should give a very simple projection for the period from last arrival_date to 31-07-2021.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |