Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I have a report that uses a fiscal calendar table in my model. On a Monday when I run my stats I want to show on a graph, the previous weeks value, the month to date value and the YTD value.
I have a slicer for fiscal week which will give me the previous weeks info but I then need to show the month to date based on that week and also the year to date. So if I am filtering on Week 2, I would see week 2, month to date would show sum of week 1 and 2, year to date in this instance would also show sum week 1 and 2.
As another example, lets fast forward to week 6 which would be the 2nd week of May, if I filter on week 6 I would see Week 6, I would see weeks 5 and 6 for month to date and then all 6 weeks for YTD.
How can I achieve this?
Thanks
@PatrickWork2021 , Make sure that week are part date table, based on week you have alose create fiscal year and fiscal month
then you can have measures like
YTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Week] <= Max('Date'[Week]) ))
LYTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Week] <= Max('Date'[Week])))
and for month
MTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Month]=max('Date'[Month]) && 'Date'[Week] <= Max('Date'[Week]) ))
LMYTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Month]=max('Date'[Month]) && 'Date'[Week] <= Max('Date'[Week])))
Hi, thanks for this, with a slight amendment it looks to have worked. One challenge I have though with a couple of metrics I need to apply this to is that the calculating field is a measure which it doesnt seem to allow me to select. Is there anything I can do to amend for when the field being calculated is a measure?
User | Count |
---|---|
84 | |
78 | |
69 | |
46 | |
42 |
User | Count |
---|---|
106 | |
50 | |
49 | |
40 | |
40 |