Forum Discussion
Anonymous
5 years agoNot applicable
Dynamic Age Groups - DAX
Hi, I am trying to represent the age demographic(with dynamic groups) across a workforce in DAX and I am having some trouble trying to represent it in the form of a graph. I have the following ...
- Anonymous5 years ago
Hi Anonymous ,
Try this measure.
Count = SWITCH ( MAX ( 'Table (2)'[Age Bracket] ), "18-24", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', YEAR ( TODAY () ) - 24 <= YEAR ( [Date of Birth] ) && YEAR ( [Date of Birth] ) <= YEAR ( TODAY () ) - 18 ) ), "25-34", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', YEAR ( TODAY () ) - 34 <= YEAR ( [Date of Birth] ) && YEAR ( [Date of Birth] ) <= YEAR ( TODAY () ) - 25 ) ), "Under 18", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', YEAR ( TODAY () ) - 18 >= YEAR ( [Date of Birth] ) ) ) )Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
5 years agoSuper User
Anonymous , New mewasure
age =
Var _1 = if(isbalnk(max(Table[Termination Date]) ,selectedvalue(Date[Date]), min(selectedvalue(Date[Date]),Table[Termination Date]))
return
datediff([Hire Date], _1,month)/12
Create an independent sequence table
New Table = addcolumns(generateseries(1,10,1), "end", [Value]+.999999)
Not this will give range , create measures help from this table
refer how to do using my video : https://youtu.be/CuczXPj0N-k
or
https://www.daxpatterns.com/dynamic-segmentation/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization