Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
The result set stops at 11/15/20.
If I use what I think is the MaxDate calculation, it does not stop at the expected point:
I'm attempting to just add 49 days to the mindate, then use that as the maximum date. But the list goes on until the end of the entire dataset.
Any help would be greatly appreciated !
Thanks,
Jeff
Hi @mssqlsage,
I'd like some dummy data with raw table structure to test, it should help us clarify your structure and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaxoin Sheng
@mssqlsage , If you do not control by a slicer or relative date slicer or filter, then that video of 12month is an example of how to control.
https://www.youtube.com/watch?v=duMSovyosXE
Hi @amitchandak ,
Thank you for the solution. This is an approach I had not considered. I have added the appropriate columns to the date table, and using the following measure in an attempt to limit the results to the next 7 weeks after the slicer selection:
@mssqlsage , Not very clear. But you can create week in your date table and work on week instead of dates
new columns in date table
Start Year = STARTOFYEAR('Date'[Date],"3/31")
WeekDay = WEEKDAY([Date],2) //monday
Start of Week = [Date] -[WeekDay]+1 //monday
FY Year = YEAR('Date'[Start Year]) // use end year
FY Week = QUOTIENT(DATEDIFF(Minx(FILTER('Date',[FY Year]=EARLIER([FY Year])),'Date'[Start of Week]),[Date],DAY),7)+1
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
measures
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))
Last 7 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-7 && 'Date'[Week Rank]<=max('Date'[Week Rank])))
last two weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]<=max('Date'[Week Rank])-1
Also, refer if data is getting clubbed into one row
https://www.youtube.com/watch?v=duMSovyosXE
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |