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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Countdown of SUM Total for week forecast

Hello

 

We have a table that shows a total of items dispatched through out the week as shown in Table 1. I have been asked to produce a Table (as shown in Table 2) which essential counts down through the week to show how much could be left to go out.

 

Table 1

  location alocation blocation c
1Mon11859278
2Tue17388343
3Wed18271337
4Thu17366301
5Fri19572335
6Sat4123109
7Sun4517

 

Table 2

  location alocation blocation c
1Mon8863841720
2Tue7683251442
3Wed5952371099
4Thu413166762
5Fri240100461
6Sat4528126
7Sun4517

 

Essentially, Table 2 does a SUM of all values in the relevant column for days equal to or greater than. For example, for Table 2 on Wednesday it will only look at Table 1 Wednesday to Sunday and for Friday it will only look at Table 1 Friday to Sunday in the relevant locations.

 

Any guidance would be massively appreciated! 🙂

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi there... I'm not entirely clear about what you really want. Please have a look at the file and decide if you can use it. Maybe you just have to tweak it a bit to make it work. No idea.

 

https://1drv.ms/u/s!ApyQEauTSLtOgYMxIzn3upDklkgToQ?e=QKbGiC

 

Best

D

View solution in original post

9 REPLIES 9
Greg_Deckler
Community Champion
Community Champion

Maybe Days of Supply?

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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello @Greg_Deckler 

 

I don't believe this would work for me as our data is in individual lines so it appears as:

 

IDLocationDateTimeDayComments
1a10/03/2020 14:58Tuecollected late due to traffic
2b10/03/2020 15:55Tue 
3a11/03/2020 10:01Wedissue with collection system
4c11/03/2020 13:44Wed 
5a14/03/2020 09:01Sat 

 

So I need it to essentially COUNT all rows, and depending what day of the week it is, it will need to could all days or from Wednesday onwards for example.

 

I have a seperate table for days with an ID so I can sort it in the order i require:

 

IDDay
1Mon
2Tue
3Wed
4Thu
5Fri
6Sat
7Sun

 

 

Wait, that table doesn't look like the tables you posted earlier, what is the correct representation of your source data?



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello @Greg_Deckler 

 

Apologies, the table I just sent is the raw data before I do anything to it. It has a line for each item delivered with date/time, location code and day.

 

From my original post, Table 1 is what I have in PBI using a Matrix which shows the totals for each day i.e. Mon-Sun and Location and Table 2 is the desired outcome for what I need. This is essentially a SUM of all Table 1 Mon-Sun then on Tuesday Tue-Sun etc etc. The forumla I would expect to be a COUNT of the raw data and determines if Mon then count all Mon-Sun whereas if it is Wed it would count all Wed-Sun.

 

We have already built this in Excel but this uses Table 1 data which I dont believe we can do in PBI?

 

Annotation 2020-03-17 132040.png

Anonymous
Not applicable

Hi there.

"We have already built this in Excel but this uses Table 1 data which I dont believe we can do in PBI?"

You can do ANYTHING in Power BI. But for data transformation you need to use Power Query, not DAX.

Best
D
Anonymous
Not applicable

Hello @Anonymous 

 

Love the enthusiasm! 😀

 

Just with the calculation, I have added WEEKDAY(Date,2) so that for the Date/Time I have a column next to it to say 1 for Mon up to 7 for Sun. Could I then use the table which has the ID and Day to do something like the below (but in a format that works! 😅)

 

CALCULATE(COUNT(Delivery[DateTime])+0,FILTER(Delivery,Delivery[Weekday]>=Days[ID]))
 
The idea is that the count will add all the data which I will split using the Matrix as shown on Table 2 then using the calculate/filter to count where weekday is greather than or equal to the day. If that makes sense!
Anonymous
Not applicable

I can see your raw data above.... but I don't think it's all there is to it. You only say about days of the week but I suspect this is not the full story. If you have dates in your rows, they can come from different years. When you drop just plain names of days onto a table visual, you could then have days from different months and years aggregated. This is certainly not what you want.

So, the real question is: What in fact is your data and how the measure should behave when not only days are selected but months, quarters...?

Can you please enlarge upon this a bit?

Best
D
Anonymous
Not applicable

Hello @Anonymous 

 

Within PBI I have limited the data to only pull back the last 4 weeks so for us this will suit our estimated forecast based on previous weeks figures.

 

Essentially, we will be using the data to say, for the rest of the week (Tue-Sun) we are expecting 589 deliveries to take place from Location A. This is why we only need to look at the full 4 weeks data (divided by 4 to create an average) for our forecasts.

Anonymous
Not applicable

Hi there... I'm not entirely clear about what you really want. Please have a look at the file and decide if you can use it. Maybe you just have to tweak it a bit to make it work. No idea.

 

https://1drv.ms/u/s!ApyQEauTSLtOgYMxIzn3upDklkgToQ?e=QKbGiC

 

Best

D

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.