Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
migueldfr_23
Contributor III
Contributor III

Enter a second KPI with last months.

Hi group, 

I am facing a challenge task with my dashboard.

I have a KPI showing the total user there are in the selected months

migueldfr_23_0-1702455543335.png

Now I would like to have second KPI showing the SUM of the previous months to those selected. (just previous from the first selected in order by months)

migueldfr_23_1-1702456499475.png

 

I appreciate any help.

Thank you 

 

 

Labels (3)
8 Replies
PrashantSangle

you can achieve it using set analysis

Sum({<date={"=$(=date(max(date)-1))"}>}Sales)

 

you can customized as per your need. also to get more accurate answer, please provide some sample data & required output.

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
migueldfr_23
Contributor III
Contributor III
Author

migueldfr_23_0-1702458468722.png

 

This is the data, and we supposed we selected DECEMBER, NOVEMBER AND OCTOBER (SUM = 1000)

second KPI should take AUTOMATICALLY months JULY, AUGUST AND SEPTEMBER (SUM=450)

Thanks @PrashantSangle 

PrashantSangle

find below snip.

PrashantSangle_0-1702462948367.png

 

My Script

Test:
Load Date,
Date(Date#('01/'&Date&'/2023','DD/MMM/YYYY')) as new_date,
Users Inline [
Date, Users
Jul, 200
Aug, 100
Sep, 150
Oct, 400
Nov, 500
Dec, 100
];
Exit Script;

 

KPI - For selected Months - Sum(Users) 

KPI - For Previous Months - Sum({<Date=,new_date={"<$(=min(new_date))"}>} Users)

Hope this will help you.

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
migueldfr_23
Contributor III
Contributor III
Author

Sum({<Date={">=$(=Date(MonthStart(AddMonths(MonthStart(min(Date)), -3))))<=$(=min(Date))"}, Users)

This is showing up a value, but it is not what I want 

 

Thanks

migueldfr_23
Contributor III
Contributor III
Author

I am not able to get the data in my case. 


I am getting the data from Google Analytics and this has different structure...

Sum({<new_date={">=$(=AddMonths(Max(new_date), -3))<=$(=AddMonths(Max(new_date)))"}, metric_type={'totalUsers'}, dimension={"no Dimension"}>} value)

but it showing up data, that is not useful for me.

I want to show the data from last 3 month till teh minum selected.

I appreciate any help. Thank you 

 

migueldfr_23
Contributor III
Contributor III
Author

RangeSum(Above(Sum({<metric_type={'totalUsers'}, dimension={"no Dimension"}, new_date -= {'*'}>} value), 0, RowNo(Total)))

Incluso probando esta, me da valores que estan seleccionados,eso no lo quiero.

Ahidhar
Creator III
Creator III

use this

First KPI :- sum(Users)

Second KPI :- sum{1-$}Users)

Ahidhar_0-1702966235407.png

 

 

migueldfr_23
Contributor III
Contributor III
Author

This works, but not as in my case.

I have to filter this columns : metric_type, dimension by these values and then I can get the values I want.

sum ( {1-$} {<metric_type={'totalUsers'}, dimension={"no Dimension"} value)

by the way, this is Google Analytics 

Thank you