Forum Discussion
powerbi92614
7 years agoNew Member
I need help creating a YTD count measure
I can't believe I'm stuck on such a simple task. I have a table that contains data from 2018 to now. Basically, I need a measure to count the total number of rows for 2018. I used this measure an...
- 7 years ago
powerbi92614 , give this one a try. It forces the date range to be the full prior year.
PY YTD = VAR MaxDate = MAX ( 'Escalation Log'[Date Received] ) VAR PYStart = DATE ( YEAR ( MaxDate ) -1, 1, 1 ) VAR PYEnd = DATE ( YEAR ( MaxDate ) -1, 12, 31 ) RETURN CALCULATE ( COUNT ( 'Escalation Log'[Date Received] ), DATESBETWEEN ( 'Escalation Log'[Date Received], PYStart, PYEnd ) )
jdbuchanan71
Super User
7 years agopowerbi92614 , give this one a try. It forces the date range to be the full prior year.
PY YTD =
VAR MaxDate = MAX ( 'Escalation Log'[Date Received] )
VAR PYStart = DATE ( YEAR ( MaxDate ) -1, 1, 1 )
VAR PYEnd = DATE ( YEAR ( MaxDate ) -1, 12, 31 )
RETURN
CALCULATE (
COUNT ( 'Escalation Log'[Date Received] ),
DATESBETWEEN ( 'Escalation Log'[Date Received], PYStart, PYEnd )
)powerbi92614
7 years agoNew Member
jdbuchanan71 that worked! wow, wish it didn't have to be so complicated! thank you so much!