Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
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...