Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 nehapathak
		
			nehapathak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I want to extract month number from name in expression(measure).
for example if month name is March it should return me 3. Kindly suggest me a function for that in qliksense.
The format of Qlikview and Qliksense are similar. May be this?
Num(Month(FieldName)) as MonthNum
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Num(Month(Date#(MonthText,'MMM'))) // If months are short names like, Jan, ...
Or,
Num(Month(Date#(MonthText,'MMMM'))) // if months are full names like, January, ....
 
					
				
		
 avinashelite
		
			avinashelite
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		The other way would be is to create a inline table for 12 month with the value and you could map that with number
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		And if you have created the month field in the script using month() already, you could simply use num() to get number like:
Num(Month)
 
					
				
		
 poojashribanger
		
			poojashribanger
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Neha,
You can use this expression
Mod(Month(DateField) - $(vFiscalYearStartMonth),12)+1
where vFiscalYearStartMonth is an variable in my case i have assigned it with 4 you can assign according to your requirement
 prma7799
		
			prma7799
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Like this???
Load
Date,
Num(Month(Date)) AS MonthNumber
....
 puneetagarwal
		
			puneetagarwal
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Tresesco,
I could retrieve month number from date column but i need both the numbers
Eg: "20190101" is my date format if I use num(month(fieldname)) , I am getting output as "1" but my requirement is "01"
how do i get that?
Thanks in advance
Regards,
Puneet
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you need two-digit output, try using number formatting, like:
num(month(fieldname), '00')
 puneetagarwal
		
			puneetagarwal
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks Tresesco
I got the correct output.
Regards,
Puneet Agarwal
