Forum Discussion
Conditional Sum
- 4 years ago
Hi, Anonymous ;
Try to create those measures.
A = CALCULATE(SUM('Table'[Value]),'Table'[Name]="A")B = CALCULATE(SUM('Table'[Value]),'Table'[Name]="B")C = CALCULATE(SUM('Table'[Value]),'Table'[Name]="C")D = calculate(Sum('Table'[Value]), filter(allselected('Table'), [Date] = max('Table'[Date]) && [Name] in {"A", "B"} ) )ratdio = [D]/[C]The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The data is helpful, thank you.
The 2nd part of my question has not been answered:
Please show me what the desired output is
Hi HotChilli,
The following could be one of the possible outcomes.
Let me write a few lines for explanation as well. I have created a new column for the new curve which is D. Then in the Conditional Sum column, for a given date, we shall add the value of A and B. About the phrase Can't decide, actually this is one of the problems of this post. As we can observe that adding the values from two rows into one row will leave one empty line blank. I have absolutely no clue how this should or would be tackled in Power BI.
| Name | Date | Value | New Curve | Conditional Sum |
| A | 25-Jul-22 | 10 | D | 23 |
| B | 25-Jul-22 | 13 | D | Can't decide |
| C | 25-Jul-22 | 16 | D | Can't decide |
| A | 26-Jul-22 | 19 | D | 31 |
| B | 26-Jul-22 | 22 | D | Can't decide |
| C | 26-Jul-22 | 25 | D | Can't decide |
| A | 27-Jul-22 | 28 | D | 59 |
| B | 27-Jul-22 | 31 | D | Can't decide |
| C | 27-Jul-22 | 34 | D | Can't decide |
I hope I have clarified the problem. Looking forward to listening back from you.
Many thanks.