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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
zhang305195102
Frequent Visitor

2列类别计算第3列的均值

用1和2分类计算3的平均值

捕获.PNG

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

Hi @zhang305195102

You can try to use the following measure formula to calculate the average value based on specific field groups:

formula =
CALCULATE (
    AVERAGE ( 'Table'[P_LPP_Out_L(bar)] ),
    ALLSELECTED ( 'Table' ),
    VALUES ( 'Table'[SN] ),
    VALUES ( 'Table'[TP NO.] )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
zhang305195102
Frequent Visitor

请问用什么公式可以计算SN(REF-48)在LPP Motor Speed[rpm](120)的时候P_LPP_Out_L[bar]的UCL和LCL,

就是条件1加条件2计算条件3的UCL和LCL

Hi @zhang305195102,

You can modify the allselected part with filter function to add more filter conditions:

formula =
CALCULATE (
    AVERAGE ( 'Table'[P_LPP_Out_L(bar)] ),
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[rpm] = 120 ),
    VALUES ( 'Table'[SN] ),
    VALUES ( 'Table'[TP NO.] )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

您好,非常感谢你的帮助,可能是我没有描述清楚,我想得到结果,用条件1加条件2计算条件3的上限和下限,能在Power Bi 里面进行快速选择出我想知道的SN号零件在120或者830时候多次测试的均值的上限和下限。

v-shex-msft
Community Support
Community Support

Hi @zhang305195102

You can try to use the following measure formula to calculate the average value based on specific field groups:

formula =
CALCULATE (
    AVERAGE ( 'Table'[P_LPP_Out_L(bar)] ),
    ALLSELECTED ( 'Table' ),
    VALUES ( 'Table'[SN] ),
    VALUES ( 'Table'[TP NO.] )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

捕获.PNG

 

您好 首先感谢您的帮忙, 我使用了您告诉我的公式,但是没有没有得到我想要的结果,可能是我没有描述清楚或者是我描述错误,用了您的公式计算出来的3个编号的样件结果是一样的,这个我不知道是不是我公式输入错误照成的,请问您有其他的公式吗?

Hi @zhang305195102,

In fact, my formula is measure expression. You can't directly use in calculated column or their row context will be fixed to get wrong result. If you are looking for calculated column version, you can take a look at the below formulas:

 

formula =
CALCULATE (
    AVERAGE ( 'Table'[P_LPP_Out_L(bar)] ),
    FILTER (
        'Table',
        'Table'[rpm] IN { 120, 830 }
                && 'Table'[SN] = EARLIER ( 'Table'[SN] )
                && 'Table'[TP NO.] = EARLIER ( 'Table'[TP NO.] )
    )
)

 

Here are some blog links about row context and difference between calculated column and measure, you can take a look on them if they helps:

Row Context and Filter Context in DAX - SQLBI

Calculated Columns and Measures in DAX - SQLBI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors