Sum ONLY for distinct rows

Hi, I have a table like this.

 

BatchStudent
A1
A1
B2
B2
C2
C2
C2

I want to show a score card showing 'Sum of students across all distinct batches', i.e. 1 + 2 + 2 = 5. The normal sum function gives me 12. I want to sum only for distinct batches, i.e. A -> 1, B -> 2, C->2.

Is there a way to do this on Looker Dashboard, without having to create a separate pivot/group by table?

Will be grateful for any help.

1 9 1,593
9 REPLIES 9

Hey @Test_Analytics !
Can you share what type of measures you are using?
You can share the LookML as well, in order to give you proper solution.

Hello dear, I meet this problem too. Please help us

Hey @sovandy !
Please share screenshots or explain a little bit the fields that you are selecting and what is the goal of what you want to achieve.

Hi @dsimeonova, I have a similar question. I have blended data between two tables, something like:

TABLE A

PROJECT IDBudget
Project A250.000
Project B500.000
Project C750.000

TABLE B

PROJECT IDPartner
Project APartner 1
Project APartner 2
Project APartner 3
Project BPartner 2
Project BPartner 3
Project CPartner 3

With the blended source, I get duplicated budget rows, so that when I visualize a budget indicator, with no filters, it is a lot higher that the correct. I would definitely need a SUM_DISTINCT function. Could you help me? 

In the context of LookML, you can do this with the sum_distinct measure.

To confirm with you @g_cavallo , are you using Looker Studio or Looker ?
Because as how you expressed yourself, sounds like the issue that you have is on Looker Studio? Is that correct?

Exactly, I'm trying to get it into Looker Studio. Is that possible? 

 

 

I'm afraid that I don't have enough experience on Looker Studio to confirm on that topic.
The other question ( as far as I understand) was related to Looker, which has completely different functionalities than Looker Studio (even though they share common name).

The simplest option is to create a field with a window operation, for example a row_number for the Batch field and Student, and for the calculation perform the sum of the Student field when the value of the window operation is 1.

Top Labels in this Space