Forum Discussion

dana1's avatar
dana1
Frequent Visitor
9 years ago

Selecting Random set of Records from a Datase

 hello,

 

I have a big dataset of calls to our call center.

i want to select 10% random rows every day (for polls).

 

any suggestions?

2 Replies

  • v-huizhn-msft's avatar
    v-huizhn-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi dana1,

    Which database do you use? When you get data in Power BI desktop, you can program statement to filter your data. For example, if you store data in SQL Server database, use the following statement to filter your data. Please replace the column and table names to yours.

    SELECT TOP   
      (SELECT COUNT(*)/10 FROM [Test].[dbo].[ZZZZZ_____Test1])  
           [EmpName]
          ,[CustNetID]
          ,[ScanDate]
      FROM [Test].[dbo].[ZZZZZ_____Test1]
      ORDER BY NEWID()


    In Power Bi desktop, click "get date" on home page->SQL Server, then type the statement in statement box. 



    Best Regards,
    Angelia

  • v-huizhn-msft's avatar
    v-huizhn-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi dana1,

    Have you resolved your issue? If you have, please mark the helpful or right reply as answer. So more people will find workaround easily.

    Best Regards,
    Angelia