Forum Discussion
Define row values based on other rows in hierarchy
- 4 years ago
Hi,
Here is one way to do this:TotalToZero =var test = CALCULATE(SUM(TotalToZero[Value]),NOT(CONTAINSSTRING(TotalToZero[Subaccount],"total")),ALL(TotalToZero[Subaccount]))returnIF(test>0,CALCULATE(SUM(TotalToZero[Value]),filter(TotalToZero,NOT(CONTAINSSTRING(TotalToZero[Subaccount],"total")))),SUM(TotalToZero[Value]))I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
Hi,
Here is one way to do this:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
Thank you for the solution.
Update a bit of Original query to get the Main account totals as expected.
TotalToZero =
VAR DetailSum =
CALCULATE(
SUM('Fact Account'[Value])
,'Dim Account'[isTotalAccount] = 0
,ALL('Dim Account'[Sub Account])
)
VAR Result =
IF(
DetailSum > 0 && ISFILTERED('Dim Account'[Account])
,CALCULATE(
SUM('Fact Account'[Value])
,filter(
'Dim Account'
,'Dim Account'[isTotalAccount] = 0
)
)
,CALCULATE(
SUM('Fact Account'[Value])
,filter(
'Dim Account'
,'Dim Account'[isTotalAccount] = 1
)
)
)
return
Result