- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Need Help - Query to perform summation of a column by selecting distinct rows based on a column
Hi, I am very new to BI. I am trying to get the sum of column X by filtering the distinct rows based on the Column A.
My Data looks like below
RecID | BatchID | RecordCount | Remarks |
201611280350010172 | 092860 | 2 | ABC |
201611280350010172 | 092860 | 2 | llsjd |
201611280350010172 | 092860 | 2 | fgfd |
201611280350010172 | 092860 | 2 | dfg |
201611280350010172 | 092860 | 2 | dfg |
201611280350230000 | 935613 | 3 | ythe |
201611280350230000 | 935613 | 3 | shyht |
201611280350230000 | 935613 | 3 | sdr |
201611280350230000 | 935613 | 3 | utt |
201611280350202000 | 057808 | 1 | ghk |
201611280350202000 | 057808 | 1 | sdew |
201611280350202000 | 057808 | 1 | dfgj |
201611280350202000 | 057808 | 1 | sdfr |
My requirement is to take the distinct rows based on column RecID and sum the values in column RecordCount.
so my expected value is 2+3+1 = 6.
Please advise how I can achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @kiran85
You can create a new summary table using this DAX. I've assumed your main table is called Table1.
You can create SUM based measures on this table that will give you the result of 6
Summary Table = SUMMARIZE( 'Table1', Table1[RecID], "RecordCount",MAX('Table1'[RecordCount]) )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @kiran85
You can create a new summary table using this DAX. I've assumed your main table is called Table1.
You can create SUM based measures on this table that will give you the result of 6
Summary Table = SUMMARIZE( 'Table1', Table1[RecID], "RecordCount",MAX('Table1'[RecordCount]) )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Phil_Seamark wrote:Hi @kiran85
You can create a new summary table using this DAX. I've assumed your main table is called Table1.
You can create SUM based measures on this table that will give you the result of 6
Summary Table = SUMMARIZE( 'Table1', Table1[RecID], "RecordCount",MAX('Table1'[RecordCount]) )
Hi @Phil_Seamark. Thanks for your response. Unfortunately I am receiving an error as "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Phil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For Phil solution you have to press the New Table button and then enter the formula!
Here's an alternative using the Query Editor's Group By feature...
Both methods will give you the same result!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Sean

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
03-14-2024 04:55 AM | |||
03-18-2024 10:25 AM | |||
11-07-2023 10:12 PM | |||
06-13-2024 06:49 PM | |||
05-17-2024 01:44 PM |