Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 ?

7 Replies
Chanty4u
MVP
MVP

try this

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

nsetty
Partner - Creator II
Partner - Creator II

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


Does above work?

dwforest
Specialist II
Specialist II

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

currentMonth = MonthName(today())

balabhaskarqlik

currentMonth = Month(Max(date));

Expression:

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

Thiago_Justen_

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
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
Anonymous
Not applicable
Author

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_

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
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago