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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
BItoken
Helper III
Helper III

Total Sales Previous 5 dates of 7 days interval based on selected date

Hi,

 

I have a requirement where when i select a date, i need to get the total sales of the Selected date and 7 days apart upto 5 series including the selected date.

For Example:  If selected date is 20-Aug (Will be a filter where user can select any date)

This is a snapshot data of the sales taken everyday so the requirement is to check the trend in total sales based on selected dates as to what were the total sales on the particular day where a snapshot of the whole data is being taken every day

 

Selected Date  Output Dates 
20-Aug 20-Aug
  13-Aug
  6-Aug
  30-Jul
  23-Jul

 

Any help is much appreciated

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @BItoken ,

 

Based on my understanding, I'm afraid this can't be achieved. If you want to display these dates as slicers, you need to create corresponding calculated columns. However, the calculated column is static and cannot be changed dynamically according to the slicers.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@BItoken , assume you have a date table and you have selected a date , Try a measure like

 

measure =
var _max = maxx(allselected(Date), Date[Date])
return
calculate(countrows(date), filter(all(Date), date[Date] >= _max -35 && mod(datediff(date[Date], _max,day),7) =0 ))

 

plot with Date of date table.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  i have to calculate the sum of the sales for these dates actually.

I tried using ur function but it does not generate any data

 

last 7 day series 5 =
var _max = maxx(allselected(Date_table), Date_table[fulldate])
return
calculate(SUM(Sales[Total Sales USD]), filter(all(Date_table), Date_table[fulldate] >= _max -35 && mod(datediff(Date_table[fulldate], _max,day),7) =0 ))

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors