The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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
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))
@Anonymous , use relative date slicer https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range
or refer to this