Forum Discussion
powerbidev123
Solution Sage
1 month agoDax help
Age = YEAR(UTCNOW())- MID('Application'[Date of Birth],7,4) . here MID('Application'[Date of Birth],7,4) is text value , how can i make it integer in dax in the same formula
- 1 month ago
powerbidev123 Multiply by 1.
Age = YEAR(UTCNOW())- ( MID('Application'[Date of Birth],7,4) * 1 ) - 1 month ago
Wrap the MID with VALUE() to convert the text to a number:
Age = YEAR(UTCNOW()) - VALUE(MID('Application'[Date of Birth], 7, 4))INT() also works, but VALUE is the more idiomatic choice when the string is a plain number.
One heads up: if [Date of Birth] is actually a date column you can skip MID entirely and just use YEAR('Application'[Date of Birth]). Also bear in mind this returns a rough age based on year only, without checking whether the birthday has passed this year.
If this helped, a thumbs up and accepting the solution would be appreciated.
Thanks,
Shai Karmani
Greg_Deckler
Community Champion
1 month agopowerbidev123 Multiply by 1.
Age = YEAR(UTCNOW())- ( MID('Application'[Date of Birth],7,4) * 1 )