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.
Greetings all, I'm scratching my head trying to figure out how to essentially "roll forward" data into the next month if the end of week falls in that month.
The rows in the 'Sales' contain the $ amount and the date (1/3/2022 etc). The calendar table has an EOW column and the relationship is between the 'Sales' date and calendar date.
Using the example above, I would want the EOW data for 1/2/2022 to fall in January, not split between the two months. 2/6/2022 would fall into Febuary only, etc.
example tables:
SALES
DateKey | Sales |
12/27/2021 | 500 |
12/28/2021 | 600 |
12/31/2021 | 1000 |
1/1/2022 | 1500 |
1/2/2022 | 700 |
CALENDAR
Date | Month | Year | EOW |
12/27/2021 | 12 | 2021 | 1/2/2022 |
12/28/2021 | 12 | 2021 | 1/2/2022 |
12/29/2021 | 12 | 2021 | 1/2/2022 |
12/30/2021 | 12 | 2021 | 1/2/2022 |
12/31/2021 | 12 | 2021 | 1/2/2022 |
1/1/2022 | 12 | 2022 | 1/2/2022 |
1/2/2022 | 12 | 2022 | 1/2/2022 |
Thanks in advance, hope this makes sense and I've provided enough data.
Solved! Go to Solution.
@J_Zayak , For That either display data week wise of create week month on week start date or week end date
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],1)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],1)
Month Year = format([Week Start Date],"MMM-YYYY")
or
Month Year = format([Week END Date],"MMM-YYYY")
Month Year Sort= format([Week Start Date],"YYYYMM")
or
Month Year Sort= format([Week END Date],"YYYYMM")
Simple enough, just keep the "Month" symbol of a whole week the same as the start of the week,
let
Source = Table.FromList(List.Dates(#date(2021, 12, 27), 10, #duration(1, 0, 0, 0)), Splitter.SplitByNothing(), {"Date"}),
EoW = Table.AddColumn(Source, "EoW", each Date.EndOfWeek([Date],Day.Monday)),
#"Virtual Month" = Table.AddColumn(EoW, "Virtual Month", each Date.ToText(Date.StartOfWeek([Date]), "MMM yyyy"))
in
#"Virtual Month"
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@J_Zayak , For That either display data week wise of create week month on week start date or week end date
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],1)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],1)
Month Year = format([Week Start Date],"MMM-YYYY")
or
Month Year = format([Week END Date],"MMM-YYYY")
Month Year Sort= format([Week Start Date],"YYYYMM")
or
Month Year Sort= format([Week END Date],"YYYYMM")
This is the way. Thank you
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 |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |