Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for 
Search instead for 
Did you mean: 
444sofiane
Contributor II
Contributor II

Fix a Value to a Sample Load

Hello everyone !

I have a task where I need to create a sample table which as 40 random rows in it from an existing tab and I have already this script using Sample() but sample doesn't return a fix value and I would like to know if it is possible to have it return only 40 values (for now it returns between 30 and 60 rows).

[App_Name]:
DT_MAJ,
ID_APL as ID,
LB_APL as Name,
MC_MAJ;
SQL SELECT *
FROM "LUAU_UCR".dbo."TB_Application";

LET vTotalRows = NoOfRows('App_Name');
LET vPercent = (100 * 40 / $(vTotalRows)) / 100 ;

[Sample_Table]:
QUALIFY *;
Sample $(vPercent) LOAD * Resident App_Name;

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel

You could either generate this sample in SQL itself or use the QlikView prefix First rather than Sample, maybe sorting by a random value you generate in your initial load.

https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptP...

 

View solution in original post

1 Reply
MarcoWedel

You could either generate this sample in SQL itself or use the QlikView prefix First rather than Sample, maybe sorting by a random value you generate in your initial load.

https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptP...