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
AlexBill
Regular Visitor

Wrong total in a measure column

Hi everyone!

Before to write about this problem I have searched everything on this topic and applied every solution I have found. But it didn't help. The problem is following:

FactorVol=

sumx(

          Values('calendar'[date],
if(

hasonefilter('prod'[product]),

( [Qnt_Act] - [Qnt_bp] ) * [price_bp],

Sumx(

values('prod'[product]),

( [Qnt_Act] - [Qnt_bp] ) * [price_bp]

)))

the problem is in calculation of [price_bp]. Here it is:
calculate(

sumx(filter('rev_bp', 'rev_bp'[item] = "a"), 'rev_bp'[revenue])
/

sumx(filter('rev_bp', 'rev_bp'[item] = "a"), 'rev_bp'[qnt]),

allselected()

)

When I remove allselected() total is fine, but it's essential to have it in formula.

You can see the matrix with wrong total in column FactorVol (54,76 is incorrect number)

IMG_6828.jpeg

so I am asking for help

 

 

2 REPLIES 2
AlexBill
Regular Visitor

Thanks a lot,

In spite of getting the right total the problem stays the same because total itself hasn't changed. Solution changed values in the rows:

image.jpg

Instead it seems to me we have to change calculation of Price_BP so that we get following results:

IMG_6834.jpeg

in another words we need to stick price of item "a" for each other items in particular period

so let's explore further

Anonymous
Not applicable

Hi @AlexBill ,

 

The problem may be that SUMX's iterator sets ALLSELECTED's shadow filter to VALUES (). Try to save [price_bp] to a variable before iteration, for example:

 

 

FactorVol= 
VAR price = [price_bp]
RETURN
sumx(
          Values('calendar'[date],
if(
hasonefilter('prod'[product]),
( [Qnt_Act] - [Qnt_bp] ) * price,
sumx(
values('prod'[product]),
( [Qnt_Act] - [Qnt_bp] ) * price
)))

 

 

 

 

Best regards,

Mengmeng Li

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.