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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Display past 10 days of Sales at any given date (Like 02/02, 04/04)

Hi PowerBi Community!

 

I know this might be a stupid question but I really need your help... Any advice or guidance is much appreciated!

 

I have a dataset that looks something like this:

Report DateSellerProductNumber of Product Sold
01/01/2018AApple4
01/01/2018BPear3
02/01/2018AOranges5
02/01/2018AApple1
02/01/2018CBanana22
02/01/2018DBanana4

Note that I have data for the entire year of 2018 with multiple Seller and Products and MULTIPLE Products sold on the same day!

 

I need to create a PowerBi Dashboard that could allow me to show the past 10 days of sales at any given time!

More particularly, I want to track the sales of different sellers and products on dates like 02/02 or 03/03 or 06/06 where there are certain sales campaign/promotions going on during this period. 

 

An example of how that would look like is:

Past 10 Days (WHAT I NEED)Seller/ProductTotal Product Sold (Sum)
28/05/2018A90
29/05/2018A88
30/05/2018A100
31/05/2018A55
01/06/2018A60
02/06/2018A123
03/06/2018A143
04/06/2018A155
05/06/2018A199
06/06/2018A201

 

I would like to be able to filter by the Seller/Product but most importantly is to select a specific date and get ONLY the past 10 days of data. I know its difficult because it spills over to the previous month.

 

So here's what I think I need: I would need to create either a new Column like the "Report Date" but instead of showing me the entire year's data, I will create a filter that says 02/02 or 03/03 or 06/06 and the new column will give me the last 10 days including the filtered date. I need to be able to show the dates for all the past 10 days.

 

Do let me know if I can give more information. 

 

THANK YOU!!!

2 REPLIES 2
Ahmedx
Super User
Super User

 

 

 

Measure =
VAR _MaxDate = max('CALANDAR'[Date])
VAR _Last10 dayes = _MaxDate-10
RETURN
CALCULATE ([Product Total ], 
'CALANDAR'[Date]>=_Last10 dayes&&'CALANDAR'[Date]<= _MaxDate)

-----  or ----
Measure =
VAR _MaxDate = max('CALANDAR'[Date])
VAR _Last10 dayes = _MaxDate-10
RETURN
CALCULATE ([Product Total ], 
     KEEPFILTERS(DATESBETWEEN('CALANDAR'[Date],_Last10 dayes,_MaxDate)))

 

 

 

Anonymous
Not applicable

Hi Ahmedx! Thanks so much for your reply!

 

Sorry, I tried to implement the measure you shared but the measure does not give me the Product Total for each of the past 10 days. The Report Date is not able to show the date of the past 10 days either. 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.