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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JeanMariePBI
Helper I
Helper I

Incorrect Total in Measure

Hello,   

The total in my measure for "Elasticity" is incorrect and it is still calculating rows that I have tried to filter out.   I need the total in the measure to only calculate the rows that have "Dir Customer PP Count" > 3.  This is a snapshot of the table before I added the >3 logic:

JeanMariePBI_0-1651842878399.png

This is the table after >3 logic added:

JeanMariePBI_1-1651842965057.png

The total elasticity remains unchanged at 0.81.  The measure is working correctly at the row level by not calculating elasticity for rows w>3 PP but the total is incorrect

.

This is the logic for the elasticity calculation:

JeanMariePBI_2-1651846381741.png

With this calculation, I can't create another measure to do a sumx(values... or avgx(values.....  I need the calculation to be performed at the total level using only qualified rows that have >3 PP

Still fairly new to BI, any help would be greatly appreciated.

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @JeanMariePBI ,

 

In general for this problem, try to use the sumx function for accumulation, similar to the following.

M =
VAR a =
    CALCULATE ( COUNTROWS ( 'Table' ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
RETURN
    IF ( a > 2, SUM ( 'Table'[Value] ), BLANK () )
M_ = SUMX('Table',[M])

vhenrykmstf_0-1652250928394.png


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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-henryk-mstf
Community Support
Community Support

Hi @JeanMariePBI ,

 

In general for this problem, try to use the sumx function for accumulation, similar to the following.

M =
VAR a =
    CALCULATE ( COUNTROWS ( 'Table' ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
RETURN
    IF ( a > 2, SUM ( 'Table'[Value] ), BLANK () )
M_ = SUMX('Table',[M])

vhenrykmstf_0-1652250928394.png


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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

davehus
Memorable Member
Memorable Member

Hi @JeanMariePBI ,

 

Try for the last line of code

 

Sumx(Firstnonblank(DimensionColumn,1), ifstatement on last line)

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.