Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Conditional Sum

Hi, I want to get sum of some rows from a given data set. I can better explain my query from the following example.   In the image attached, I have a dataset containing three names A, B, and ...
  • v-yalanwu-msft's avatar
    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.