Forum Discussion
TJI7746
1 year agoRegular Visitor
DAX Help with Row totals not adding correctly.
Hi everyone I have the following 2 DAX formulas 1) HC Current Quarter = VAR _maxdate = MAX('Headcount'[Date]) RETURN CALCULATE([Headcount],'Calendar'[Date] = _maxdate) And 2) HC ...
BeaBF
Super User
1 year agoTJI7746 Hi! Try with:
HC Current Quarter =
VAR _maxdate = MAX('Headcount'[Date])
RETURN
IF(
HASONEVALUE('Calendar'[Date]),
CALCULATE([Headcount], 'Calendar'[Date] = _maxdate),
SUMX(
SUMMARIZE(
'Headcount',
'Calendar'[Date],
"HC", CALCULATE([Headcount], 'Calendar'[Date] = _maxdate)
),
[HC]
)
)
HC Previous Quarter =
VAR _maxdate = MAX('Headcount'[Date])
VAR _prevq = CALCULATE(
MAX(Headcount[Date]),
FILTER(ALL('Headcount'), Headcount[Date] < _maxdate)
)
RETURN
IF(
HASONEVALUE('Calendar'[Date]),
CALCULATE([Headcount], 'Calendar'[Date] = _prevq),
SUMX(
SUMMARIZE(
'Headcount',
'Calendar'[Date],
"HC", CALCULATE([Headcount], 'Calendar'[Date] = _prevq)
),
[HC]
)
)
BBF
TJI7746
1 year agoRegular Visitor
This didn't work unfortunately 😞