Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all-
I'm looking to calculate last 8 weeks based on WeekEnd Date which I've already created a calculated column:
WeekEnd Date= dimCalendar[Date]+7-1*WEEKDAY(dimCalendar[Date],1)
Should I use a RANX formula to label the weeks?
I want to be able to show SUM for this period (week) and last 8 periods/weeks.
Would RANKX be a step in the right direction?
Then maybe create that aggregate measure saying SUM(COLUMN), FILTER(TODAY- Last 8 periods)?
I'm all over the place here. Would appreciate any help!
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
I think, becasue it is calculating week-base, perhaps it is better to use a simple calculation like 7 times 7 periods = 49 days.
Please check the below picture and the attached pbix file. I hope the below can provide some ideas on how to create a solution for your dataset.
Sales last 8 weeks: =
VAR _todaysweekend =
MAXX (
FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] = TODAY () ),
'Calendar'[WeekEnd Date]
)
VAR _eightweeksperiodstartdate = _todaysweekend - 49
RETURN
CALCULATE (
[Sales measure:],
KEEPFILTERS ( 'Calendar'[Date] >= _eightweeksperiodstartdate
&& 'Calendar'[Date] <= _todaysweekend )
)
Hi @whatisdata96 ,
I am really pleased that your issue has been fixed. Would you kindly share with us about your solution here? In this way, it will be beneficial to other community members as well.
Best regards,
Community Support Team_ Binbin Yu
Wow this is wonderful. I wish I was able to do this on my own.
From what I understand, you first created a variable that selected the MAX TODAY WeekEnd Date, then another variable which takes that MAX WeekEND date - 49 days which captures all the data/dates needed for the pivot, correct?
Then Returning the aggregation using the 2 variables as parameters. Am I understanding this correctly?
Hi,
Thank you for your message, and you are correct. 🙂
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
I think, becasue it is calculating week-base, perhaps it is better to use a simple calculation like 7 times 7 periods = 49 days.
Please check the below picture and the attached pbix file. I hope the below can provide some ideas on how to create a solution for your dataset.
Sales last 8 weeks: =
VAR _todaysweekend =
MAXX (
FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] = TODAY () ),
'Calendar'[WeekEnd Date]
)
VAR _eightweeksperiodstartdate = _todaysweekend - 49
RETURN
CALCULATE (
[Sales measure:],
KEEPFILTERS ( 'Calendar'[Date] >= _eightweeksperiodstartdate
&& 'Calendar'[Date] <= _todaysweekend )
)
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |