Skip to main content

# Japan

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$300 before February 6: REGISTER NOW!
cancel
Showing results for
Search instead for
Did you mean:
Partner - Contributor II

## 生年月日から現在までの経過月数を計算する方法

とある生年月日のリストから、その人ごとに現在までの月数を出す計算をしたいと思っているのですが

たとえば、

1992/2/15 の誕生日の人がいて、この人の現在までの月数を出すため

よろしくお願いいたします。

Labels (3)

• ### アーキテクチャ

1 Solution

Accepted Solutions
Specialist

Hi Suguru

SET MonthDiff = Num(((year(\$2) * 12) + month(\$2)) - (((year(\$1) * 12) + month(\$1))) + If(Day(\$1) > Day(\$2), 0, 1) );
LET vDateToday = NUM(Today());

EXAMPLE:
LOAD date(DATE,'DD/MM/YYYY') AS DATE,
\$(MonthDiff(DATE,\$(vDateToday))) AS MONTHSSSSS

;
LOAD * Inline
[
DATE,MonthsDifference
17/11/2014,
04/11/2015,
04/11/2013,
04/11/2011,
21/11/1975,
]
;

2 Replies
Specialist

Hi Suguru

SET MonthDiff = Num(((year(\$2) * 12) + month(\$2)) - (((year(\$1) * 12) + month(\$1))) + If(Day(\$1) > Day(\$2), 0, 1) );
LET vDateToday = NUM(Today());

EXAMPLE:
LOAD date(DATE,'DD/MM/YYYY') AS DATE,
\$(MonthDiff(DATE,\$(vDateToday))) AS MONTHSSSSS

;
LOAD * Inline
[
DATE,MonthsDifference
17/11/2014,
04/11/2015,
04/11/2013,
04/11/2011,
21/11/1975,
]
;

Partner - Contributor II
Author
Hi fer fer  SAN
This advice was very helpful !
thank you so very much
Tags