Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I Used FieldValueCount function to count the number of rows of a field in a column, in detail to count the number of rows in each column of my table.
My problem is, i am getting one row more than the rows of that i have in each column
can anyone help me with this/.. How a FieldValueCount function works
Thanks
Ganesh
NoConcatenate
FactGetPOChangeTime:
LOAD
TagsForPOTime,
if(TagsForPOTime='Fill A',POTime,0) as FillATime,
if(TagsForPOTime='Fill A',1,0) as CountA,
if(TagsForPOTime='Fill B',POTime,0) as FillBTime,
if(TagsForPOTime='Fill C',POTime,0) as FillCTime
Resident GetPOChangeTime;
TotalCount:
Load
Sum(CountA) as TotalCountA
Resident FactGetPOChangeTime:
Let vRowsFilATIme = Peek('TotalCountA');
Drop Table TotalCount;
FieldValueCount is a function that directly uses in-memory system tables. Because of this it does not take selections, chart dimensions and expressions into account. Try using the Count function instead. Perhaps Count(distinct total MyField) does what you want.
Hi Gysbert
Yes, I want to count the number of values of a row in a table which is acquired by using Resident Table. so, i am using that for in-memory table only i suppose. I am taking the result of fieldvaluecount function into a variable using let
I mean
Let vNoofrows=fieldvaluecount('fieldname');
I am not using any selections or any chart
I am just interested in counting the number of rows for each field in a table..
I am getting the exactly one value more than the number of rows in each column.. is it also counting the column name??
Thank you
Ganesh
FieldValueCount will give you the total number of distinct values of a field over all tables. You can't make it tell you the number of distinct values of a field from only one table if the fields exists in multiple tables.
yeah, even i thought of possibility of giving table name in fieldvaluecount function .
could you please tell me, how to count the number of rows in a table, i am getting syntax error when i try like this
let vrowcount=count(fieldname);
and I want to count all the rows in a field, i dont want to use distinct
Thanks
Ganesh
If you only want the number of rows of a table instead of the number of unique values of a field in a table then use the NoOfRows() function. That function accepts a table name as parameter.
sorry.. i want number of rows in each field
NoConcatenate
FactGetPOChangeTime:
LOAD
TagsForPOTime,
if(TagsForPOTime='Fill A',POTime,0) as FillATime,
if(TagsForPOTime='Fill B',POTime,0) as FillBTime,
if(TagsForPOTime='Fill C',POTime,0) as FillCTime
Resident GetPOChangeTime;
I want to count the number of rows for each fields FillATime. FillB ime, FillCTime
like
let vRowcountFilATIme = count(FillATime);
like this i want to store the row count in a variable, to use that further in my code
Thank you
Ganesh
Hi
Try like this
Temp:
Load Count(FillATime) AS FATime, Count(FillBTime) As FBTime, Count(FillCTime) AS FCTime resident FactGetPOChangeTime;
Let vRowcountFilATIme = Peek('FATime');
Let vRowcountFilBTIme = Peek('FBTime');
Let vRowcountFilCTIme = Peek('FCTime');
Drop Table Temp;
Hope this helps
Each row of a table will contain all the fields. So the count of rows for each field is the count of rows of the table.
Hi Mayil
I tried this way, but , I am getting the result of first column for other columns also.. i dont know why
I mean NoOfRows for FillATime is also coming for other columns