Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Correction in the Expression

Hi,

Please help me...Is there something wrong in this expression.

Aggr(SUM({<Date = {">=$(=Date(Max(Date)-7,'DD-MMM-YYYY')))<=$(=Date(Max(Date)-7,'DD-MMM-YYYY'))"}>}Sales),Product)

its excluding last 7 days data. Actually I need only last 7 days data. instead of other

Thnx,

John

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Assuming that your Date field is in DD-MMM-YYYY format.


SUM({<Date = {">=$(=Date(Max(Date)-7,'DD-MMM-YYYY'))<=$(=Date(Max(Date),'DD-MMM-YYYY''))"}>}Sales)

or

SUM(Aggr(SUM({<Date = {">=$(=Date(Max(Date)-7,'DD-MMM-YYYY'))<=$(=Date(Max(Date),'DD-MMM-YYYY''))"}>}Sales),Product))

View solution in original post

7 Replies
PrashantSangle

Hi,

Try like

Aggr(SUM({<Date = {">=$(=Date(Max(Date)-7,'DD-MMM-YYYY')))<=$(=Date(Max(Date),'DD-MMM-YYYY'))"}>}Sales),Product)

Regards

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 🙂
MK_QSL
MVP
MVP

Assuming that your Date field is in DD-MMM-YYYY format.


SUM({<Date = {">=$(=Date(Max(Date)-7,'DD-MMM-YYYY'))<=$(=Date(Max(Date),'DD-MMM-YYYY''))"}>}Sales)

or

SUM(Aggr(SUM({<Date = {">=$(=Date(Max(Date)-7,'DD-MMM-YYYY'))<=$(=Date(Max(Date),'DD-MMM-YYYY''))"}>}Sales),Product))

Anonymous
Not applicable
Author

Tried this before.....its showing all the data...Any other Suggestions Max....

Thnx

John

MK_QSL
MVP
MVP

What is the format of your DATE field?

Anonymous
Not applicable
Author

Thnx Manish,

the second expression did the magic...cud u pls explain why Sum before Aggr ..made this work....

Thnx,

John

MK_QSL
MVP
MVP

SUM(Sales) will create TotalSales

Aggr(SUM(Sales),Product) will create a virtual table with Product as Dimension and SUM(Sales) as Expression

But we need Total SUM(Sales) for All Products... so we need to again use SUM

SUM(Aggr(SUM(Sales),Product))

Anonymous
Not applicable
Author

Excellent!!!