Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
wenkew186
Creator
Creator

calculate gap between max date and min date in one scope

hi folks,

In my data, there have some date in one week.

I want get the gap between the max date with min date in same week . look the template. it means max date data minus min date data in this week by week dimension. how to write the expression?

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try:

FirstSortedValue(Aggr(Sum(Sales), Week,Date),-Date)

-

FirstSortedValue(Aggr(Sum(Sales), Week,Date),Date)

View solution in original post

12 Replies
tresesco
MVP
MVP

Try:

FirstSortedValue(Aggr(Sum(Sales), Week,Date),-Date)

-

FirstSortedValue(Aggr(Sum(Sales), Week,Date),Date)

wenkew186
Creator
Creator
Author

Hi Tressco,

look my expression, but it is not works for my real data,no any data display. is there any condition for this fucnction (FirstSortedValue)?

FirstSortedValue(Aggr(Sum([Secured Amount]), Week,[SNP Process Date]),-[SNP Date])
-
FirstSortedValue(Aggr(Sum(
[Secured Amount]), Week,[SNP Process Date]),[SNP Date])

tresesco
MVP
MVP

Do you have two different dates - [SNP Process Date] and [SNP Date] ? I guess you have to use one date field in both the places in the expression.

uacg0009
Partner - Specialist
Partner - Specialist

Hi Kevin,

I think Tresesco is so good, and if you can make sure the Date is a distinct value, no any repeat date in one week.

Then I think the formula also can be :

FirstSortedValue(Sales,-Date)

-

FirstSortedValue(Sales,Date)


Thanks.

vinieme12
Champion III
Champion III

why not [SNP Process Date], is it different?

FirstSortedValue(Aggr(Sum([Secured Amount]), Week,[SNP Process Date]),-[SNP Process Date])
-
FirstSortedValue(Aggr(Sum(
[Secured Amount]), Week,[SNP Process Date]),[SNP Process Date])

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
wenkew186
Creator
Creator
Author

Pujari,

thanks, it should one name.

wenkew186
Creator
Creator
Author

Tresesco,

thank you, it's should one name, just write wrong.

thanks,

wenkew186
Creator
Creator
Author

Aiolos ,(changjun?)

hope you are well!

what's means no any repeat date? the template is simple, but in my real data there have many dimension, so it means many row base on dimension in one date.

thanks,

Kevin.

wenkew186
Creator
Creator
Author

Hi Tresesco,

looks the issue is date not distinct, like Aiolos said. but my real data have many dimension. so one date has many row data. I have update a new template. can you help check again?

thanks.