Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
smitpau
Helper I
Helper I

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 measure but uses the expression as the Company 1 values. This means it's specific to Company 1 so for Company 2 I'd have to duplicate it.

 

The new measure would ideally not require a specific company to be used in the measure expression to calculate the first three rows.

 

https://1drv.ms/u/s!Ajcv_9xvRfBd5ztQeRbRnFa5h1Am?e=mO0Ncf

 

Hope that makes sense.

 

Thanks for reading.

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

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:

b1.png

 

Best Regards

Allan

 

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

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

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:

b1.png

 

Best Regards

Allan

 

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

lbendlin
Super User
Super User

For each company sum up the values where [SI] is between 1 and 3.

 

Why do you have separate tables per company? You shoud combine the tables into one, either via DAX UNION() or better in Power Query.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors