March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |