Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

get number of rows for data for the current year and month

I have a table divers

SELECT [Code Site]

      ,[Datedesdivers]

FROM [dbo].[Divers]

I need to get number of rows for data for the current year and month

How can I modify it ?

let noRows = NoOfRows('Divers')

2 Replies
sunny_talwar

May be create a temporary table with only current year and month of data and count the number of rows in it?

Divers:

SELECT [Code Site],

              [Datedesdivers]

FROM [dbo].[Divers]

Temp:

NoConcatenate

LOAD *

Resident Divers

Where Num([Datedesdivers]) >= Num(MonthStart(Today()))

Let noRows = NoOfRows('Temp')

julian_rodriguez
Partner - Specialist
Partner - Specialist

I'm assuming that the code is the SQL code, so try something like adding a 1 for each row loaded:

LOAD 1 As NoRows,

     *;

SQL SELECT [Code Site]

      ,[Datedesdivers]

FROM [dbo].[Divers];

Then, on the front end, you can use Sum(NoRows) to get the number of rows for the current selections, on this table.

Regards,