The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I have 'Week' column and it is from 'Week from File Name' which is from Left function(e.g. file name: W10_ABC.xlsx).
So 'Week' column value is not actually from Date related dax calculations.
*sometimes files updated late so I didn't use Week number or Date related function just to align with file name.
I wanna make last week measure to compare last vs current week.
But there are 2 obstacles:
1. Week Number or Date related function wouldn't work because the files sometimes updated late.
e.g. if current week is W13 and file of W12 uploaded this week(uploader forgot and upload late) then this one should be sorted as W12 although it's been actually uploaded at W13.
If we use Date function then it would be sorted as current calendar week as W13 rather than W12.
2. 'Week' column will be filtered by slicer so if we use Filter/All function then last week value couldn't be shown.
So what I want is:
To filter by 'Week' column value:
If I select W12 then W12 data show as this week and W11 data still show as last week.
If I select W10 then W10 data show as this week and W09 data still show as last week.
*Accordingly 'vs Last Week' measure calculations should be aligned.
I've tried Max, Selectedvalues, Rank, etc but still struggling.
Please help!
Solved! Go to Solution.
@jeongkim , if you have a year. Create a new table with Year, week, and year week and year week rank column
Date = Summarize(Table, table[Year], Table[Week No])
new columns
Year Week = [Year]*100 + [Week No]
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format
These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
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
Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
@jeongkim , if you have a year. Create a new table with Year, week, and year week and year week rank column
Date = Summarize(Table, table[Year], Table[Week No])
new columns
Year Week = [Year]*100 + [Week No]
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format
These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
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
Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Thanks I think it works!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
101 | |
97 | |
80 | |
62 | |
57 |
User | Count |
---|---|
264 | |
120 | |
115 | |
83 | |
70 |