Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I have a date table and followed this instrucional video to create a Week-to-date, Month-to-date and Year-to-date
When I used this measures, my Last year same week to date measures don't show with this.
I am trying to create something like this
WTD | WTD | MTD | MTD | YTD | YTD | |
TY | LY | TY | LY | TY | LY | |
Sales | 100 | 90 | 400 | 350 | 900 | 850 |
When I use WTD, MTD, YTD date filters, my Last year measures go away
WTD | WTD | MTD | MTD | YTD | YTD | |
TY | LY | TY | LY | TY | LY | |
Sales | 100 | 400 | 900 |
Not sure how I would move forward. Should I try to create a calculation group with this year's WTD/MTD/YTD and last year's WTD/MTD/YTD. I think it's harder since I am not able to use "Same period last year", since I work in retail and need to match up the week numbers.
// Assuming you've got a proper calendar
// that's been marked as such... The Year
// field I use in the code might be a
// year field that's not the true year but
// a modified field that's aligned with the
// weeks. That's because weeks don't go equally
// into years and you might have artificial
// years that are aligned to the weeks. So, please
// bear this in mind when you try to adjust this
// code.
[WTD LY] =
var LastVisibleDay = LASTDATE( Dates[Date] )
var LastVisibleWeekNumber =
CALCULATE(
SELECTEDVALUE( Dates[WeekNumberInYear] ),
LastVisibleDay
)
var VisibleYear =
CALCULATE(
SELECTEDVALUE( Dates[Year] ),
LastVisibleDay
)
var DayNumberInWeek_ =
CALCULATE(
SELECTEDVALUE( Dates[DayNumberInWeek] ),
LastVisibleDay
)
var Result =
CALCULATE(
[your measure],
// Move back 1 year
Dates[Year] = VisibleYear - 1,
// Stay on the same week number
Dates[WeekNumberInYear] = LastVisibleWeekNumber,
// This condition will grab all days in the
// week up to and including DayNumberInWeek_
// just the way it should be to obtain WTD
Dates[DayNumberInWeek] <= DayNumberInWeek_,
// This will remove any filters from Dates
// and you need this since there are no filters
// here that operate directly on Dates
REMOVEFILTERS( Dates )
)
return
Result
The other measures can be obtained in a very similar way with some obvious changes.
@OCBB_SFAFPandA , You need to use the calculation group for that
I have shown few samples here
Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0
For Time intellignece
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
18 | |
15 | |
11 | |
11 | |
8 |
User | Count |
---|---|
24 | |
18 | |
12 | |
11 | |
10 |