Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

rolling values up through multiple parents

The SQL here may not be exact, but it illustrates what I'm attempting. How do I write a DAX statement that gets me the same output?

 

Select issueid, sum(timespent), parentid

From (Select Select issueid, sum(timespent), parentid

From (Select issueid, sum(timespent), parentid from issues

Group by parentid) group by parentid) group by parentid;

 

Issues table looks like:

Issueid

timespent

parentid

1

5

 

2

10

 

3

45

1

4

17

2

5

12

3

6

77

3

7

11

4

8

70

4

 

So what I’m looking for in regard to issueid 1 is to see the sum of timespent for issueid 1, 3, 5 and 6, and for issueid 2, the sum of timespent for issueid 2, 4, 7 and 8.