The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello Everyone,
I have a table that has a list of dates, and I would like to create a new column that goes through and finds the most recent date listed within every month for each year.
Here is an example of what I would like to do:
2/10 is the most recent day listed in Feb of 2020 so it receives a 1 and March 31 is the most recent day in March of 2020 so it receives a 1.
Any advice would be greatly appreciated, thanks!
Solved! Go to Solution.
[Is Most Recent...] = // calculated column
var CurrentDate = T[Date to Check]
var MonthStart = EOMONTH( CurrentDate, -1 ) + 1
var NextMonthStart = EOMONTH( CurrentDate, 0 ) + 1
var Result =
CurrentDate = MAXX(
filter(
T,
MonthStart <= T[Date to Check]
&&
T[Date to Check] < NextMonthStart
),
T[Date to Check]
)
return
1 * Result
[Is Most Recent...] = // calculated column
var CurrentDate = T[Date to Check]
var MonthStart = EOMONTH( CurrentDate, -1 ) + 1
var NextMonthStart = EOMONTH( CurrentDate, 0 ) + 1
var Result =
CurrentDate = MAXX(
filter(
T,
MonthStart <= T[Date to Check]
&&
T[Date to Check] < NextMonthStart
),
T[Date to Check]
)
return
1 * Result
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |