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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Stacked Area Chart to display last 28 days data only based on Data Slicer input date value

Hi all, 

 

Am trying to display the last 28 days data in the Stacked Area chart, by writing measure on Value but it's not working here. 

 

The same logic is working on Matrix visual. 

 

 

3 REPLIES 3
AllisonKennedy
Super User
Super User

Can you provide a bit more info?

To troubleshoot this I would look at what is different between the Stacked Area and Matrix- level of granularity (Day vs Month vs Year), filters, make sure you're taking the values from the same tables.

What about the Stacked Area is not working? Stacked Area does a cumulative sum that the matrix visual does not do, so what are you trying to display? I wouldn't generally put the same data in those two different visuals, so if it's 'working' on the Matrix, then what do you want displayed on the Stacked Area?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Thanks a lot for the quick reply, 

 

WTD Q = 
VAR cd=MAX(Date_FT[Filter_Date])
VAR pd=DATE(YEAR(cd),MONTH(cd),DAY(cd)-28)
VAR result= CALCULATE((SUM(Sd[QDAmount]),FILTER('Calendar Table','Calendar Table'[Date]>=pd)&&'Calendar Table'[Date]<=cd)
Return result
 

 

I have used the above logic, to populate the last 28 days' sum value display over Matrix. 

Here I found one bug on DATE function that when I am passing June 28 (This function is not working as it is doing 28-28=0 so the Date is not returning correctly for a specific date. 

 

 

Following is the  calendar date is calculated by Power BI function 

Calendar Table = CALENDAR(DATE(2019,1,1),DATE(2030,12,31))

 As am facing some problem while am writing calculations I have created one more date table with a single column and 

Date_FT = CALCULATETABLE(DISTINCT('Calendar Table'[Date]),FILTER('Calendar Table', 'Calendar Table'[Day] <>6 && 'Calendar Table'[Day]<>7))

 

amitchandak
Super User
Super User

@Anonymous , use relative date slicer https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

or refer to this

https://www.youtube.com/watch?v=duMSovyosXE

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.