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
Kpham
Resolver I
Resolver I

total of a measure incorrect

Hi can somebody tell me how  I can me my measure sum up to the correct total. The correct total for me is 2281,72+1569,08

 

It seems to wrong when i'm multiplying the initial amount time the quantity. I tried to create the quantity with a measure and one with power query. Both doesn't seem to add up to the total i'm looking for

 

Kpham_0-1625861582583.png

VC Material Costs(Today) = 


CALCULATE (
    sum ('01 Sales Material URM/VC Report'[COND_.Amount] )*SUM('01 Sales Material URM/VC Report'[Quantity2]),
    FILTER (
        '01 Sales Material URM/VC Report', 
        '01 Sales Material URM/VC Report'[COND_.URMSalesMKey]= '01 Sales Material URM/VC Report'[URMSalesMKey]
            && '01 Sales Material URM/VC Report'[COND_.Valid From] <= TODAY()
            && '01 Sales Material URM/VC Report'[COND_.Valid to] >=  TODAY()
            && FIND("MAT",'01 Sales Material URM/VC Report'[VC Variant PRD/MAT/ASS],1,0)
    
))

 

Measure 2 = 


CALCULATE (
    sum ('01 Sales Material URM/VC Report'[COND_.Amount] )*[Quantity],
    FILTER (
        '01 Sales Material URM/VC Report', 
        '01 Sales Material URM/VC Report'[COND_.URMSalesMKey]= '01 Sales Material URM/VC Report'[URMSalesMKey]
            && '01 Sales Material URM/VC Report'[COND_.Valid From] <= TODAY()
            && '01 Sales Material URM/VC Report'[COND_.Valid to] >=  TODAY()
            && FIND("MAT",'01 Sales Material URM/VC Report'[VC Variant PRD/MAT/ASS],1,0)
    
))
1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @Kpham,

 

Without knowing the structure of your data, my workaround is to use SUMX function:

var a=
SUMX (
    FILTER (
        '01 Sales Material URM/VC Report', 
        '01 Sales Material URM/VC Report'[COND_.URMSalesMKey]= '01 Sales Material URM/VC Report'[URMSalesMKey]
            && '01 Sales Material URM/VC Report'[COND_.Valid From] <= TODAY()
            && '01 Sales Material URM/VC Report'[COND_.Valid to] >=  TODAY()
            && FIND("MAT",'01 Sales Material URM/VC Report'[VC Variant PRD/MAT/ASS],1,0)
    
)
'01 Sales Material URM/VC Report'[COND_.Amount]
)
var b=
SUMX (
    FILTER (
        '01 Sales Material URM/VC Report', 
        '01 Sales Material URM/VC Report'[COND_.URMSalesMKey]= '01 Sales Material URM/VC Report'[URMSalesMKey]
            && '01 Sales Material URM/VC Report'[COND_.Valid From] <= TODAY()
            && '01 Sales Material URM/VC Report'[COND_.Valid to] >=  TODAY()
            && FIND("MAT",'01 Sales Material URM/VC Report'[VC Variant PRD/MAT/ASS],1,0)
    
)
'01 Sales Material URM/VC Report'[Quantity2]
)
return a*b

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

1 REPLY 1
v-xulin-mstf
Community Support
Community Support

Hi @Kpham,

 

Without knowing the structure of your data, my workaround is to use SUMX function:

var a=
SUMX (
    FILTER (
        '01 Sales Material URM/VC Report', 
        '01 Sales Material URM/VC Report'[COND_.URMSalesMKey]= '01 Sales Material URM/VC Report'[URMSalesMKey]
            && '01 Sales Material URM/VC Report'[COND_.Valid From] <= TODAY()
            && '01 Sales Material URM/VC Report'[COND_.Valid to] >=  TODAY()
            && FIND("MAT",'01 Sales Material URM/VC Report'[VC Variant PRD/MAT/ASS],1,0)
    
)
'01 Sales Material URM/VC Report'[COND_.Amount]
)
var b=
SUMX (
    FILTER (
        '01 Sales Material URM/VC Report', 
        '01 Sales Material URM/VC Report'[COND_.URMSalesMKey]= '01 Sales Material URM/VC Report'[URMSalesMKey]
            && '01 Sales Material URM/VC Report'[COND_.Valid From] <= TODAY()
            && '01 Sales Material URM/VC Report'[COND_.Valid to] >=  TODAY()
            && FIND("MAT",'01 Sales Material URM/VC Report'[VC Variant PRD/MAT/ASS],1,0)
    
)
'01 Sales Material URM/VC Report'[Quantity2]
)
return a*b

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

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.