Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I’m new to QlikSense and to code/script writing.
I am trying to return only the latest month values from quite a large dataset.
I have a table with amongst others the following fields
CovPer | PremRec | CovPerDate |
202001 | 50,000 | 202001 |
202002 | 30,000 | 202002 |
202003 | 45,000 | 202003 |
202004 | 60,000 | 202004 |
CovPerDate is a column I’ve added via script to convert CovPer to dateformats
I am trying to create a pivot table or graph that only shows the latest month.
i.e.
202004 | 60 000 |
I have created so far:
=maxString(CovPerDate)
sum({<Date ={'$(=$(vLatestmonth))'}>}PremRec)
Using the above I get:
vLatestMonth | Premrec |
202004 | 185,000 |
Where am I going wrong?
All help appreciated
Hi,
Try like Below
Dimension- CovPer
Measure- Sum({<CovPer={"$(=Max(Date(Date#(CovPer,'YYYYMM'),'YYYYMM')))"}>}PremRec)
pivot table
Hi,
Try like Below
Dimension- CovPer
Measure- Sum({<CovPer={"$(=Max(Date(Date#(CovPer,'YYYYMM'),'YYYYMM')))"}>}PremRec)
pivot table
Works great. Much appreciated
How would I change the above expression to add a second expression in order to show the current month as well as the previous month?
current month- Sum({<CovPer={"$(=Date(Today(),'YYYYMM'))"}>}PremRec)
previous month - Sum({<CovPer={"$(=Date(AddMonths(Today(), -1),'YYYYMM'))"}>}PremRec)