Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
MPS
Contributor III
Contributor III

Expression to show Last Month value

Dear Team,

Am trying to get the last month value to show under KPI title which is taken from the excel file. But now the KPI shows the total from Jan to Dec, wherein I want to show only the last Month data and not sum.

Data is rolling totals

MPS_0-1629381351236.png

Below is the current expression, and have a variable for previous month.  So can you please help me with the query to show last month value as 3.

current expression --- sum( {<RowType={'Other Activity'},[Other ActivityType]={'Consultant Trainings'}, [_KEY_DATE]={">=$(vYTD_DateFrom) <=$(vYTD_DateTo)"} ,YEAR=,MONTH=,Quarter=>} ActivityValue)

Previous month variable --- vPreviousMonth

Please help 

 

 

 

Labels (2)
3 Replies
agigliotti
Partner - Champion
Partner - Champion

Hi @MPS ,

try this one:

sum(  {< RowType = {'Other Activity'}, [Other ActivityType] = {'Consultant Trainings'},  MONTH={"$(=Month(Today())-1)" } >}  ActivityValue )

Best Regards

Kushal_Chawda

@MPS  may be this

sum( {<RowType={'Other Activity'},[Other ActivityType]={'Consultant Trainings'}, [_KEY_DATE]={">=$(=monthstart(max(_KEY_DATE),-1)) <=$(=monthend(max(_KEY_DATE),-1)) "} ,YEAR=,MONTH=,Quarter=>} ActivityValue)

MPS
Contributor III
Contributor III
Author

Unfortunately, both expression resulted the values to zero. Not sure if i am missing anything to do.