Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

belguith
New Contributor II

Sum Sales by month

Hello,

I'm using QlikSens Desktop

I want to create KPI visualisation whith show total SALES for the current month.

I Created a variable currentMonth = Month(today())

currentMonth value = juil.

currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]  = {'juil.'}> } Total_HT)  ---> WORKS


currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]  = {currentMonth}> } Total_HT)  DOES NOT WORKS



I also Tried


currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.MonthRelNo]  = {6}> } Total_HT)  --> this does not work also


could some one help me on this issue please ?

Tags (3)
7 Replies
sureshqv
Esteemed Contributor III

Re: Sum Sales by month

try this

= Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]  = {"$(=MaxString(YourMonthFiled))"}> } Total_HT)

nsetty
Contributor II

Re: Sum Sales by month

currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]  = {${currentMonth}}> } Total_HT)


Does above work?

dwforest
Valued Contributor

Re: Sum Sales by month

month() returns a dual value and is likely using the number for comparison, try using monthname()

currentMonth = MonthName(today())

balabhaskarqlik
Honored Contributor

Re: Sum Sales by month

currentMonth = Month(Max(date));

Expression:

currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]  = {'$( =$(currentMonth) )'}> } Total_HT)

thiago_justen
Valued Contributor III

Re: Sum Sales by month

This will be helpful:

currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]  ={$(=currentMonth)}> } Total_HT) //with parentesis...


Or:


currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]={$(=Max( [DateCmd_PK-Date_PK.autoCalendar.Month]))}> } Total_HT)



Or


currentMonthTotalSales = Sum({< [DateCmd_PK-Date_PK.autoCalendar.Month]={$(=Month (today ()))}> } Total_HT)


Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
belguith
New Contributor II

Re: Sum Sales by month

thank you for all your answers it helped me well.

I think that all your answer where right
I m new to QlikSens and the syntax wasn't pretty easy to understand for retriving local variable for me !!
Special thanks to "Thiago Justen Teixeira"
it's all good !!

thiago_justen
Valued Contributor III

Re: Sum Sales by month

Happy to help you, my friend!

If you could, please close this thread by marking one of these answers as correct.

Cheers

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
Community Browser