Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Iras
Contributor III
Contributor III

how to subtract a month inside the set analysis

Dear all, 

I am trying to write a measure for this particular case for one of my KPI i.e. 

sum({<ReportMonth={$(=addmonths(MAX(ReportMonth),-1))}>}[sales])/100 

wherein I want to sum the sales for last month.. 

here Reporting month is in data format dd.mm.yyyy. 

but this is not working could some one please help me out for this issue ? 

 

I am geeting this as error :Error in set modifier ad hoc element list: ',' or ')' expected

 

Regards 

Iras

 

Labels (2)
2 Solutions

Accepted Solutions
Anil_Babu_Samineni

Perhaps this

sum({<ReportMonth={"$(=Date(AddMonths(Max(ReportMonth),-1),'DD.MM.YYYY'))"}>} sales)/100 

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

Iras
Contributor III
Contributor III
Author

Dear Mr. Anil babu, 

 

Thanks for your reply but it didn't work out. I found other soultion for it. 

sum({<ReportMonth={$(=num(addmonths(MAX(ReportMonth),-1)))}>}[sales])/100

The problem was It has to convert to num rather than date. 

View solution in original post

3 Replies
Taoufiq_Zarra

Maye be

you can create variable MaxDate as :

=Date(Max(Date#(ReportMonth,'DD.MM.YYYY')))

 

then your formula :

=Sum({<ReportMonth = {"$(=Date(addmonths('$(MaxDate)',-1),'DD.MM.YYYY'))"}>} [sales])/100

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Anil_Babu_Samineni

Perhaps this

sum({<ReportMonth={"$(=Date(AddMonths(Max(ReportMonth),-1),'DD.MM.YYYY'))"}>} sales)/100 

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Iras
Contributor III
Contributor III
Author

Dear Mr. Anil babu, 

 

Thanks for your reply but it didn't work out. I found other soultion for it. 

sum({<ReportMonth={$(=num(addmonths(MAX(ReportMonth),-1)))}>}[sales])/100

The problem was It has to convert to num rather than date.