Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Solved! Go to Solution.
Hi @jagutierrezm ,
It seems that you need to create a weeknum column in your table. Then you can get today's weeknum and calculate the sum of values in same week and sum of values in previous week.
Something like below.
weeknum = WEEKNUM('Table'[date],2)
this week = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[weeknum]=WEEKNUM(TODAY(),2)))
last week = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[weeknum]=WEEKNUM(TODAY(),2)-1))
If i misunderstand your meaning, please let me know.
Best Regards,
Jay
Hi @jagutierrezm ,
It seems that you need to create a weeknum column in your table. Then you can get today's weeknum and calculate the sum of values in same week and sum of values in previous week.
Something like below.
weeknum = WEEKNUM('Table'[date],2)
this week = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[weeknum]=WEEKNUM(TODAY(),2)))
last week = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[weeknum]=WEEKNUM(TODAY(),2)-1))
If i misunderstand your meaning, please let me know.
Best Regards,
Jay
@jagutierrezm , Please format the post better. Every thing is in one line.
You can get week till dates like
WTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank]) && 'Date'[Weekday] <=max('Date'[Weekday])))
LWTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -1) && 'Date'[Weekday] <=max('Date'[Weekday])))
This column you need in your date table for Monday week
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Number = WEEKNUM([Date],2)
Week = if('Date'[Week Number]<10,'Date'[Year]*10 & 'Date'[Week Number],'Date'[Year]&'Date'[Week Number])
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
refer Power BI — 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...
Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...
User | Count |
---|---|
102 | |
88 | |
78 | |
71 | |
69 |
User | Count |
---|---|
113 | |
99 | |
97 | |
72 | |
68 |