Forum Discussion
Anonymous
9 years agoNot applicable
Grouping by age
Morning all, I thought I'd get a bit of time in Power BI this lovely Saturday morning. I clearly live the rock and roll lifestyle ;-) I have a list of queries for which I have created a measured...
Sean
Community Champion
9 years ago
Anonymous
It seems you have it right? Are you getting an error or...?
Age Range =
CALCULATE (
VALUES ( 'Age Profile Ranges'[Age Range Name] ),
FILTER (
'Age Profile Ranges',
'Current'[Incident Age (Days)] >= 'Age Profile Ranges'[Min]
&& 'Current'[Incident Age (Days)] < 'Age Profile Ranges'[Max]
)
)Alternatively you can create a COLUMN in your 'Current' table and use a SWITCH to create your groups like this...
Age Range ALT =
SWITCH (
TRUE (),
'Current'[Incident Age (Days)] >= 0
&& 'Current'[Incident Age (Days)] <= 5, "0-5 Days",
'Current'[Incident Age (Days)] > 5
&& 'Current'[Incident Age (Days)] <= 20, "6-20 Days",
'Current'[Incident Age (Days)] > 20
&& 'Current'[Incident Age (Days)] <= 50, "21-50 Days",
">50 Days"
)That should do it also! :smileyhappy:
piccolo37a
8 years agoNew Member
This post totally helped me group employee date of birth info into years for Generational analysis. Thank you! I had to calculate the date of birth for aging purposes, but for the year of birth...this was awesome.