Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I've got a table with the total task backlog and I'm trying to separate out what is current, last week, last week in previous month and historical.
I currently have;
Solved! Go to Solution.
Hi, @Anonymous
You can try function 'EOMONTH' to pick up the last date of the previous month, please modified the formula as below:
Type =
VAR _weekstart =
TODAY ()
+ -1 * WEEKDAY ( TODAY (), 2 ) + 1
VAR _weekend =
TODAY () + 7
- 1 * WEEKDAY ( TODAY (), 2 )
VAR _lastmonthstart =
EOMONTH ( TODAY (), -2 ) + 1
VAR _lastmonthend =
EOMONTH ( TODAY (), -1 )
RETURN
SWITCH (
TRUE (),
[Report Date] <= _lastmonthstart, "Historical",
[Report Date] >= _lastmonthstart
&& [Report Date] <= _lastmonthend, "Last month",
[Report Date] >= _weekstart
&& [Report Date] <= _weekend, "This Week",
[Report Date] >= _weekstart - 7
&& [Report Date] <= _weekend - 7, "Last Week"
)
Please check my attachment (may need refresh for latest results).
Best Regards,
Community Support Team _ Eason
@Anonymous , Try something like this
Week Type =
var _st = today() +-1*WEEKDAY(today() ,2)+1
var _end = today() + 7-1*WEEKDAY(today(),2)
return
Switch( True(),
[Date] >= _st && [Date] <= _end ,"This Week" ,
[Date] >= _st-7 && [Date] <= _end -7,"Last Week" ,
[Week Name]
)
Modify as per need
Thank you so much!
This works perfectly for this week and last week, how do I modify to pick up the last date of the previous month and return "Last Month"?
Hi, @Anonymous
You can try function 'EOMONTH' to pick up the last date of the previous month, please modified the formula as below:
Type =
VAR _weekstart =
TODAY ()
+ -1 * WEEKDAY ( TODAY (), 2 ) + 1
VAR _weekend =
TODAY () + 7
- 1 * WEEKDAY ( TODAY (), 2 )
VAR _lastmonthstart =
EOMONTH ( TODAY (), -2 ) + 1
VAR _lastmonthend =
EOMONTH ( TODAY (), -1 )
RETURN
SWITCH (
TRUE (),
[Report Date] <= _lastmonthstart, "Historical",
[Report Date] >= _lastmonthstart
&& [Report Date] <= _lastmonthend, "Last month",
[Report Date] >= _weekstart
&& [Report Date] <= _weekend, "This Week",
[Report Date] >= _weekstart - 7
&& [Report Date] <= _weekend - 7, "Last Week"
)
Please check my attachment (may need refresh for latest results).
Best Regards,
Community Support Team _ Eason
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |