Home Forums Power BI Date in custom text

Tagged: , ,

This topic contains 0 replies, has 1 voice, and was last updated by  Chelena 1 year, 4 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #9088

    Chelena
    Participant
    • Started: 1
    • Replies: 0
    • Total: 1

    Good day

    I’m a working with pediatric data. I want the column to display age “2y; 1m; 4d” from age in days. My excel recipe for this is as follows, it works fine:

    =INT([@Age]/365.2425)&”y; ”
    & INT(([@Age]-INT([@Age]/365.2425)*365.2425)/30.44)&”m; ”
    &INT([@Age]-INT([@Age]/365.2425)*365.2425-INT(([@Age]-INT([@Age]/365.2425)*365.2425)/30.44)*30.44)&”d”

    I tried to do the following and it failed:

    =Int64.From([Age]/365.2425)&”y; ”
    & Int64.From(([Age]-Int64.From([Age]/365.2425)*365.2425)/30.44)&”m; ”
    &Int64.From([Age]-Int64.From([Age]/365.2425)*365.2425-Int64.From(([Age]-Int64.From([Age]/365.2425)*365.2425)/30.44)*30.44)&”d”

    I will add the solution to my personal cookbook because I use it repeatedly for all sorts of dates.

    Thank you for your time!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.