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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
ngocnguyen
Helper IV
Helper IV

Sumx and Value is not working for sort column

Hi

I have 2 column below

table 1 is raw data

I created  Dimdate table and table 2 , then create relationship amount Table 1, table 2, dimdate table

In table 2, I sort " Zone" by "order" column to fix the order of zone

I create below measure

Sales = sum( table 1[sales])

M3 =sum( table 1[M3])

Sales/M3=divide([sales],[M3],0)

Sales/M3 LY=calculate([sales/M3],dateadd(Dimdate[Date],-1,year))

Sales LY= calculate([sales],dateadd(Dimdate[Date],-1,year))

%sales LY=DIVIDE([Sales LY],CALCULATE([Sales LY],ALL(table2[Zone])),0)

New sales =[% sales LY]*CALCULATE([Sales],ALL(table2[Zone]))

New M3 =SUMX(VALUES(table2[Zone]),DIVIDE([New sales],[Sales/M3 LY],0))

 

All measures were run well, except for "New M3" measure. the result should be like the table "output".  

Is there any mistake that I made for "New M3" measure ?, Pls help me to solve it.  I think the problem because I sort " Zone" column by "order" column in table 2?

 

table1.PNG

1 REPLY 1
dedelman_clng
Community Champion
Community Champion

Hi @ngocnguyen -

 

This should have nothing to do with it being a sort column. You might want to check your math for New M3, however. Based on your code, it should be 3/0.5 = 5 (4.5 rounded), 4/0.6 = 7 (6.67 rounded) and 5/0.666... (rounded to .7 in your visual) =  8 (7.5 rounded up).  

 

Other than not sure how to help - are you getting an error message with your code? If not, what values are you getting? And please provide a picture at your data model so we can determine if that might be the cause.

 

Hope this helps,

David

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors