Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jasmina_karcic
Creator III
Creator III

Line chart (set expression and date dimension)

Hi guys, I have set expression for a measure:

Sum({<DATE={"=$(=date(rangemin((today()-1),(MAX({State2}DATE)))))"},FIELD1 ={"A"}, FIELD2={"1"}, FIELD3={"3"}>}-1*VALUE)

-

Sum({<DATE={"=$(=date(rangemin((today()-2),(MAX({State1}DATUM)))))"},FIELD1 ={"A"}, FIELD2={"1"}, FIELD3={"3">}-1*VALUE)

It is calculating difference between values between two dates, default is for yesterday and for 2 days before. 

And it works ok.

But doesn't work if I make a line chart where is dimension DATE.

How can I make this for line chart? I want present this difference for last 7 days or more. Date is on x-axis.

Please, any suggestion is welcome.

 

Thanks,

 

Jasmina

 

 

 

Labels (1)
2 Replies
swarnendu
Creator II
Creator II

Hi Jasmina ,

Can you please share some demo file?

jasmina_karcic
Creator III
Creator III
Author

I have made it already. 

Explanation:

Table:

DATE                                       SUM(VALUE)                                      SUM(VALUE)-ABOVE(SUM(VALUE))

22.7.2019                             200                                                          -

23.7.2019                             300                                                         100

24.7.2019                             150                                                         -150

25.7.2019                             600                                                         450

26.7.2019                             430                                                        -170

I have used measure with above() function: sum(value)-above(sum(value)), and it is working. Now I have other question, how to take from this just a negative value,  but not this:  rangemin(sum(value)-above(sum(value)),0), because it will be:

 

DATE                                                             rangemin(SUM(VALUE)-ABOVE(SUM(VALUE)),0)

24.7.2019                                                                         -150

26.7.2019                                                                         -170

I don't want this. For what I want I have other table, with a new dimension:

Table:

DATE                           FIELD1               SUM(VALUE)                                 MEASURE???

22.7.2019                       A                          100                                                        -

22.7.2019                       B                            30

22.7.2019                       C                            70

23.7.2019                       A                            80                                                       

23.7.2019                       B                         120                                                         

23.7.2019                       C                         100                                                         

24.7.2019                       A                            50                                                       

24.7.2019                       B                            80                                                        

24.7.2019                       C                            20

25.7.2019                       A                         150                                                       

25.7.2019                       B                         35

25.7.2019                       C                         100

26.7.2019                       A                         100                                                      

26.7.2019                       B                         150

26.7.2019                       C                         180

 

I want something like this:

 sum(rangemin ( aggr(sum(value), FIELD1)-ABOVE(aggr(sum(value), FIELD1), 0)) 

But this doesn't give me a good result.

It should be:

DATE                                    sum(rangemin ( aggr(sum(value), FIELD1)-ABOVE(aggr(sum(value), FIELD1), 0)) 

22.7.2019                                                                        -

23.7.2019                                                                     -20

24.7.2019                                                                    -150

25.7.2019                                                                      0

26.7.2019                                                                     -250

How is this: from 22. to 23. just A got negative difference (80-100), from 23. to 24. negative difference got all three (A: -30 B:-40, C:-80)

....

 

How can I make this? My measure don't  work...:(

 

Thanks