Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have these 2 DAX expressions :
ThisWeek =
CALCULATE(
COUNTA('MyTable'[Report Date])+0,
'MyTable'[Report Date]
IN { DATE(2021, 04, 02) }
)
PreviousWeek =
CALCULATE(
COUNTA('MyTable'[Report Date])+0,
'MyTable'[Report Date]
IN { DATE(2021, 03, 26) }
)
But I want to alter them so that instead of specifing dates, they use the 2 most recent dates from the Report Dates column.
Merging this in, somehow:
CalcThisWeek = FORMAT(MAXX('MyTable','MyTable'[Report Date]),"YYYY/mm/dd")
Any ideas?
Thank you.
Solved! Go to Solution.
@Pete_81 , Try measures like
measure max Date =
var _max = maxx(allselected('MyTable'),'MyTable'[Report Date])
return
CALCULATE(
COUNTA('MyTable'[Report Date])+0,
filter('MyTable', 'MyTable'[Report Date] = _max)
)
measure 2nd max Date =
var _max1 = maxx(allselected('MyTable'),'MyTable'[Report Date])
var _max = maxx(filter(allselected('MyTable'),'MyTable'[Report Date] <_max1) ,'MyTable'[Report Date])
return
CALCULATE(
COUNTA('MyTable'[Report Date])+0,
filter('MyTable', 'MyTable'[Report Date] = _max)
)
@Pete_81 , Try measures like
measure max Date =
var _max = maxx(allselected('MyTable'),'MyTable'[Report Date])
return
CALCULATE(
COUNTA('MyTable'[Report Date])+0,
filter('MyTable', 'MyTable'[Report Date] = _max)
)
measure 2nd max Date =
var _max1 = maxx(allselected('MyTable'),'MyTable'[Report Date])
var _max = maxx(filter(allselected('MyTable'),'MyTable'[Report Date] <_max1) ,'MyTable'[Report Date])
return
CALCULATE(
COUNTA('MyTable'[Report Date])+0,
filter('MyTable', 'MyTable'[Report Date] = _max)
)
User | Count |
---|---|
40 | |
26 | |
22 | |
16 | |
15 |
User | Count |
---|---|
54 | |
35 | |
18 | |
17 | |
15 |