Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

RE:Other than Distinct?

hi all,

I have small doubt.

Is there any other function to get the distinct count  output?

Ex:count(distinct  sales)=100

the sam eoutput shud come  witout usng distinct?

Any suggestions?

Thanks In advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

In the script,

You can use

LOAD Count( DISTINCT FieldName) AS DistinctFieldNameCount

RESIDENT YourTable;

[Note: That will count only FieldName in one table, so if FieldName is a key, this may differ from the other methods]

Or as field function:

Let vDistinctFieldName = FieldValueCount( 'FieldName');

If you create a straight table chart with dimension FieldName,

=RowNo(TOTAL)

will return the distinct count as well in each line.

There probably more methods to get someway or another a distinct count, but the common way is just a

=Count( Distinct FieldName)

View solution in original post

10 Replies
sunny_talwar

Have not tested, but may be this:

Count(Aggr(Count(Sales), Sales))

sunny_talwar

Sample:

Table:

LOAD * Inline [

Sales

10

15

20

32

10

15

];

Capture.PNG

swuehl
MVP
MVP

What is your doubt concerning using

Count(Distinct FieldName)

?

What Sunny suggested works, but I see no advantage in using this?

A common practice is to create a field CounterOfFieldName in your dimensional table (that holds the distinct values of FieldName) just containing 1, then do a

=Sum(CounterOfFieldName)

Read also

A Myth About Count(distinct …)

Chanty4u
MVP
MVP
Author

thnx sunny and swuehl.....

no use of that just want to know ...

and i want to get count and with in that no duplicates? how cn i?

sunny_talwar

Count(DISTINCT ...) would be the most efficient way to do it I believe.

Chanty4u
MVP
MVP
Author

ohhh is it?    can i get usng rowno() or iter()  function?

if yes explain bro?

sunny_talwar

In the script? front end chart? front end text box object?

Chanty4u
MVP
MVP
Author

how to do in script and frnt end aswell?

swuehl
MVP
MVP

In the script,

You can use

LOAD Count( DISTINCT FieldName) AS DistinctFieldNameCount

RESIDENT YourTable;

[Note: That will count only FieldName in one table, so if FieldName is a key, this may differ from the other methods]

Or as field function:

Let vDistinctFieldName = FieldValueCount( 'FieldName');

If you create a straight table chart with dimension FieldName,

=RowNo(TOTAL)

will return the distinct count as well in each line.

There probably more methods to get someway or another a distinct count, but the common way is just a

=Count( Distinct FieldName)