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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
warfollowmy_ver
Creator III
Creator III

Pareto select with % and formula through macro

Guys, how to make the choice of analogue Pareto indicating % with macro, if it's possible? 😃

7 Replies
tamilarasu
Champion
Champion

Not sure but try like below.

Sub Test

Set Field = ActiveDocument.GetField ("Field_Name")

Percentage = ActiveDocument.Variables("A").getcontent.string

Field.ParetoSelect "RangeSum(Above(Sum(Sales),1,RowNo())) / Sum(Total Sales) <=" & Percentage/100

End Sub

warfollowmy_ver
Creator III
Creator III
Author

Thank you, but is'not work.

Maybe I made a mistake?

Set Field = ActiveDocument.GetField ("[№ Товар, код]","A_123_v")

Percentage = ActiveDocument.Variables("A").getcontent.string

Field.ParetoSelect "RangeSum(Above(Sum({<[Участвует в ABC]={'Да'}>}[Продажи, руб.]),1,RowNo())) / Sum({<[Участвует в ABC]={'Да'}>}Total [Продажи, руб.]) <=" & Percentage/100

Set Field = ActiveDocument.GetField ("[№ Товар, код]","B_123_v")

Percentage = ActiveDocument.Variables("B").getcontent.string

Field.ParetoSelect "RangeSum(Above(Sum({<[Участвует в ABC]={'Да'}>}[Продажи, руб.]),1,RowNo())) / Sum({<[Участвует в ABC]={'Да'}>}Total [Продажи, руб.]) <=" & Percentage/100

tamilarasu
Champion
Champion

You can check the below attachment for understanding.

warfollowmy_ver
Creator III
Creator III
Author

I choose 1% and macro select all, why? 😃

tamilarasu
Champion
Champion

You mean test file.? I just checked and it seems to be working fine.

warfollowmy_ver
Creator III
Creator III
Author

But macro not select % correctly, mb in him is mistake?

tamilarasu
Champion
Champion

Can you show me the screenshot.?