Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

prananellutla
Contributor

convert month name to number and use as measure

Hi

I have 2 dimensions .one among that is month .  I  want to sue scatter plot but ,that chart needs 2 measures.So is it possible to  convert month name to number and use as measure.


thanks

Prana

9 Replies
luismadriz
Valued Contributor

Re: convert month name to number and use as measure

Hi,

Sure, Num(Month) but that Scatter Plot may result a bit strange...

Regards,

Luis

devarasu07
Honored Contributor II

Re: convert month name to number and use as measure

Hi,


try like to way to get month no from month text field. better share your mock data, we can try to help u

num(month(date#(Month,'MMM'))) as MonthNumber;


sample,

load *, num(month(date#(Month,'MMM'))) as MonthNumber;

load * Inline [

Month

Jan

Feb

Mar

Jun

Jul

]

Capture.JPG

Thanks,

Deva

Highlighted
prananellutla
Contributor

Re: convert month name to number and use as measure

Thanks Luis, I already  tried that code, it works in the table but in the scatter plot  I get " chart is not displayed due to undefined values".

prananellutla
Contributor

Re: convert month name to number and use as measure

Thanks Deva- I am using Qlik sense. And I am looking to modify at the visualization level. not the data model level.

devarasu07
Honored Contributor II

Re: convert month name to number and use as measure

Hi,

how your going to use month number as another measure? i don't think this output will give u the right o/p. better share the mock data we can help u.

for the month number extraction from month u also do it in front end just use this as calculated dimension or measure

num(month(date#(Month,'MMM')))

luismadriz
Valued Contributor

Re: convert month name to number and use as measure

Hi,

Create a simple table with one dimension and two measures, and confirm those are the values you'd like to plot, than drag a scatter plot over it and select convert..

I say this just because a table may be simpler to troubleshoot.

If possible put that table together and share a screenshot,

I hope it helps,

Cheers,

Luis

prananellutla
Contributor

Re: convert month name to number and use as measure

this is my sample table.I don't think it will work not sure how to use it a measure  though.

if i use the code as a dimension it shows all the values- but when i use it as a measure i see values only where there is null in the other measure.

    

.code as dimension.code as measure(this is my measure 2)
dimension 1num(month((date ])))measure1num(MONTH((#date)))
A12null1.2E+1
A9null9.0E+0
A4null4.0E+0
B118.2-
c314.6-
c114.2-
c213.9-
c613.9-
A213.7-
C413.5-
A1112.8-
prananellutla
Contributor

Re: convert month name to number and use as measure

Hey Deva-  what you asked me is my exact question - how to use the num(month) as a measure?.is it possible if so how?

for the sample data please see my reply to Luis.

luismadriz
Valued Contributor

Re: convert month name to number and use as measure

Hi,

I wanted to see the data to show you that it may not be material for a Scatter Plot. For a plot you need a unique dimension and each unique dimension with two numbers so you can plot them. In the data you're showing you only have 4 unique dimensions or 4 unique values so you can expect 4 bubbles....  So you may need to rethink what you really want to show

I hope this helps

Untitled.png