Forum Discussion

smitpau's avatar
smitpau
Helper I
5 years ago
Solved

Calculate Measure Help

Hi,   In the attached simplified example below, I'd like to create a measure which will always sum the first three row values in the table.   The current measure I've written is a calculate measu...
  • v-alq-msft's avatar
    5 years ago

    Hi, smitpau 

     

    Based on your description, you may create a measure as below. The pbix file is attached in the end.

    Sum First 3 = 
    SUMX(
        SUMMARIZE(
            'Table',
            'Table'[Company],
            "Result",
            SWITCH(
                [Company],
                "Company1",
                CALCULATE(
                    SUM('Company 1'[Value]),
                    FILTER(
                        ALL('Company 1'),
                        VALUE([SI])<4
                    )
                ),
                "Company2",
                CALCULATE(
                    SUM('Company 2'[Value]),
                    FILTER(
                        ALL('Company 2'),
                        VALUE([SI])<4
                    )
                )
            )
        ),
        [Result]
    )

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.