Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
vitaliichupryna
Creator III
Creator III

Set Analysis based with set expression in it

Hi All,

I need calculate numbers of orders that have "returns" more than 6.
Previously for this I used following expression:
Count({<Returns={"<6"}>}Orders)

Week ago we moved to new dataset and we haven't "returns" in DB. Also after this, it's not possible to  calculate returns in the script, so I create set expression for returns: $(eReturns)
The question is following: How can I change my Count calculation to make it works with calculated expression?

8 Replies
andrey_krylov
Specialist
Specialist

Hi Vitalii, can you show this expression eReturns?

jayanttibhe
Creator III
Creator III

Hi

You said that "returns" more than 6.

But your set expression is for "returns" less than 6.   Try this way


Count({<Returns={"=Returns > 6"}>}Orders)

OR

Count({<Returns={"> 6"}>}Orders)


Both are fine in your case.

sunny_talwar

May be this

Count({<Orders={"=$(eReturns) < 6"}>} Orders)

vitaliichupryna
Creator III
Creator III
Author

eReturns is:

Sum({<Date = {">=$(vStart) <=$(=vEnd)"}>}[Issued Quantity])

/(Sum({<Date = {"<=$(vStart)"}>}[Received Quantity])-Sum({<Date = {"<=$(vStart)"}>}[Issued Quantity]))

vitaliichupryna
Creator III
Creator III
Author

Unfortunately, it doesn't work

sunny_talwar

I guess since your expression includes double quotes, the double quote within the double quote failed... try this may be

Count({<Orders={[=$(eReturns) < 6]}>} Orders)

jayanttibhe
Creator III
Creator III

Please check if it is working -

Count({<Orders={

"=$(=(Sum({<Date = {">=$(vStart) <=$(=vEnd)"}>}[Issued Quantity])

/(Sum({<Date = {"<=$(vStart)"}>}[Received Quantity])-Sum({<Date = {"<=$(vStart)"}>}[Issued Quantity]))

)

)

< 6"

}>} Orders)

sunny_talwar

I don't think this will work jayanttibhe‌ because of multiple reasons

1) You have double quotes within double quotes. You need to either use an escape sequence or use a differ thing for beginning double quote

2) You have a dollar sign expansion in the set modifier which will compare Order to a single value. I don't think that will work