Forum Discussion
How to get total value?
- 3 years ago
Hi Yonko ,
Based on your description, I have creeated a simple sample:
Please try:
Time = VAR _a = SUM ( 'Table (2)'[Time] ) VAR _b = SELECTCOLUMNS ( FILTER ( ALL ( 'Table' ), [Project] = MAX ( 'Table'[Project] ) ), "Task", [Task] ) VAR _c = SUMX ( FILTER ( ALL ( 'Table (2)' ), [Task] IN _b ), [Time] ) RETURN IF ( MAX ( 'Table'[Task] ) = "Total", _c, _a )Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Yonko
please try
Time Measure =
VAR CurrentTask =
SELECTEDVALUE ( Table1[Task] )
VAR NormalValue =
SUM ( Table2[Time] )
VAR TotalValue =
CALCULATE ( SUM ( Table2[Time] ), ALL ( Table1[Task] ) )
RETURN
IF ( CurrentTask = "Total", TotalValue, NormalValue )- Yonko3 years ago
Helper I
tamerj1 The problem in your formula happens with TotalValue = it should return sum of values (8), but instead it returns values without changing (3 and 5). If it somehow will return 8 it will work, and i tried different approaches but not succeeded. Any suggestions?
Anonymous It also returns the same values, not sum of them. I guess it happens because it filtered not only by projects, but also by tasks, so it's granularity moves from project to task and it's not working. I don't know how to fix it sadly 😞