Forum Discussion
Dynamic Age as Axis
- 6 years ago
Hi, RobinH
Based on your description, you may create two calculated tables as follows.
Age Table:
Age Table = GENERATESERIES(0,300,1)DateSlicer:
DateSlicer = CALENDAR(DATE(1950,1,1),DATE(2050,1,1))Then you can create a measure as below.
Count = COUNTROWS ( FILTER ( ADDCOLUMNS ( 'Table', "DynamicAge", ROUND ( IF ( ISBLANK ( 'Table'[Leaving Date] ), DATEDIFF ( 'Table'[DoB], MIN ( 'DateSlicer'[Date] ), YEAR ), DATEDIFF ( 'Table'[DoB], MIN ( 'Table'[Leaving Date], MIN ( 'DateSlicer'[Date] ) ), YEAR ) ), 0 ) ), [DynamicAge] IN FILTERS ( 'Age Table'[Value] ) ) )You may restrict the range of year with the visual level filter.
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Allan v-alq-msft
Thats awesome, thank you very much.
One more question, is there a possibility to create a tooltip that shows me the name, surname and DoB?
Because at the moment it shows me the list of all peolpe which fits in to the filters.
Thank you
Regards
Robin
Hi, RobinH
You can manage to achieve it. Please refer to the following link.
https://docs.microsoft.com/en-us/power-bi/desktop-tooltips
Here is my tooltip and result.
tooltip:
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.