Calcualted Field for a Count
16 January, 2014
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?
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.
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
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