Forum Discussion
New Measures - Weekly Current Year, Weekly Last Year, YTD Weekly Current and YTD Weekly Last Year
Hi there,
I have a transaction list. It runs on daily basis. I have it summarized by week ending #.
Something like this:
Ticket Number | Date | Amount | Week Ending #
It could have multiple transactions every day in the week.
I am trying to create a few measures to capture:
Weekly Current Year Amount
Weekly Last Year Amount
YTD Weekly Current Year Amount
and YTD Weekly Last year Amount
I have tried a few coding... doesn't seem to work...
Please advise.
Jen
9 Replies
- parry2k
Super User
Anonymous there are tons of posts on time intelligence, did you searched and tried?
Here is a link to few:
https://www.red-gate.com/simple-talk/sql/bi/creating-time-intelligence-functions-in-dax/
I would 💖 Kudos 🙂 if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
- AnonymousNot applicable
Those are informative posts.
My question is more on what to do with Weekly measures. The YTD, QTD or MTD work fine for me. Given WTD or week to date functions are not available in Power BI, I need further guidence.
Thank you
Jen
- parry2k
Super User
Anonymous there are tons of resources on WTD as well, here is a link to one
- v-lionel-msft
Community Support
Hi Anonymous ,
Do you want to create the following four measures?
Please give example data for all used tables.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
- v-lionel-msft
Community Support
Hi Anonymous ,
Maybe you can do like this:
Weekly Current Year Amount = CALCULATE( SUM(Sheet1[Amount]), FILTER( ALL(Sheet1), Sheet1[Year] = SELECTEDVALUE( Sheet1[Year]) && Sheet1[Week] = SELECTEDVALUE(Sheet1[Week]) ) )Weekly Last Year Amount = CALCULATE( SUM(Sheet1[Amount]), FILTER( ALL(Sheet1), Sheet1[Year] = SELECTEDVALUE(Sheet1[Year]) - 1 && Sheet1[Week] = SELECTEDVALUE(Sheet1[Week]) ) )YTD Weekly Current Year Amount = CALCULATE( SUM(Sheet1[Amount]), FILTER( ALLSELECTED(Sheet1), Sheet1[Year] = SELECTEDVALUE(Sheet1[Year]) && Sheet1[Week] <= SELECTEDVALUE(Sheet1[Week]) ) )YTD Weekly Last year Amount = CALCULATE( SUM(Sheet1[Amount]), FILTER( ALLSELECTED(Sheet1), Sheet1[Year] = SELECTEDVALUE(Sheet1[Year])-1 && Sheet1[Week] <= SELECTEDVALUE(Sheet1[Week]) ) )Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.