This forum is now out of date, for our new forum Click Here
Calcualted Field for a Count
Question Asked
What is the best way to create a calculated field for a count? I tried just dragging a Metric Calculated field onto the available fields, using a formula of 1 with an aggregate of sum. However, this has mixed results. It doesn't count right on a report when it is the only metric in a report. But seems to work when there are other metrics. Did I stumble on a bug or is there another suggested way to do this?

null

Fri Jan 17, 2014 2:06 AM

Comment
Hi Clayton

I believe this forum post contains the solution you looking for

Regards,
Stephen

Stephen

Fri Jan 17, 2014 8:29 PM

Comment
Not quite. I just want add a count field in my Data Source View so it is available from any report and you can drag it in as a field to get a count of fact table record for any level of grouping that your are doing in the report. I believe I found a way to do this. I create a calculated metric field, and the formula is count ( [any field in fact table ] ) And then I make the aggregate a count. It seems a little counterintuitive but it appears to work now.

null

Sat Jan 18, 2014 4:47 AM

Comment
Hi Clayton,

Glad you found a solution that works for you.

I must have misunderstood the question, thought you wanted row numbers.
I would have done something similar, create a Calculated field at View level, to return 1, and then you apply count as the default aggregation.

Regards,
Stephen

Stephen

Mon Jan 20, 2014 7:52 PM