Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
kseniyav
Contributor II
Contributor II

Calculate vs last month. Months as numbers

Hi, may be somebody can help me

Now I have the date, which I divided on Year, Month, date.

The part of my script is here: 

DATE ( "Дата поступления претензии") AS Date,

Month ( "Дата поступления претензии") AS Month,

Year ( "Дата поступления претензии") AS Year,

Currently I have Months as the names (Jan, Feb, Mar....).

The aim - I want to calculate metrics versus last month

for ex: to clik  in filters: 2018 Jun   and have metric for automatic calculation vs previous month (in this case it is 2018 May)

But I can't do it.

How I can add the new column with month as numbers (1, 2, 3, 4...12) and apply Max\Min (Month) function ?

Or may be you know another decision?

my formula: Count([Numbers of complaints])/Sum({<[Source of claim]=>}ktn)

P.S: for calculation vs full last year work this:

(Count({$<Year={"$(=Max(Year))"}>}[Numbers of complaints])/Sum({$<Year={"$(=Max(Year))"},[Source of claim]=>}ktn))-

(Count({$<Year={"$(=Max(Year)-1)"},Month=>}[Numbers of complaints])/Sum({$<Year={"$(=Max(Year)-1)"},[Source of claim]=, Month=>}ktn))

2 Replies
Anil_Babu_Samineni

To trasfer month names to month numbers, you need

Num(Month ( "Дата поступления претензии")) AS MonthNum


Then, call

Max(MonthNum) as maxmonth,

Min(MonthNum) as minmonth


Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
kseniyav
Contributor II
Contributor II
Author

Thanks a lot!!!!!