cancel
Showing results for
Did you mean:
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 Date Seller Product Number of Product Sold 01/01/2018 A Apple 4 01/01/2018 B Pear 3 02/01/2018 A Oranges 5 02/01/2018 A Apple 1 02/01/2018 C Banana 22 02/01/2018 D Banana 4

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/Product Total Product Sold (Sum) 28/05/2018 A 90 29/05/2018 A 88 30/05/2018 A 100 31/05/2018 A 55 01/06/2018 A 60 02/06/2018 A 123 03/06/2018 A 143 04/06/2018 A 155 05/06/2018 A 199 06/06/2018 A 201

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.

THANK YOU!!!

2 REPLIES 2
Solution Sage

``````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

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.

Announcements

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors