Forum Discussion

GreyMerchant's avatar
GreyMerchant
Frequent Visitor
6 years ago
Solved

Getting correct total amount from DAX syntax from sumx() call

Hello,

 

I have a little toy problem I put together for my actual problem. The data you can use is the below:

 

FoodImportanceWeight
1201002000
80953000
50864000

 

*In addition to this you will need a simple slider which will determine the cut off.

 

I want to create a combined measure for Food as follow:

 

Combined Measure Food =

VAR A =
sumx(Matrix,Matrix[Food]/Matrix[Importance]*100)

VAR B =
sumx(Matrix,if(A>'Cut off'[Cut off Value],1,0))

VAR C =
sumx(Matrix,B*Matrix[Weight])

RETURN
C
 
The 'Cut off'[Cut off Value] is a slider and that will determine if something qualifies or not.
 
The current output looks like this. I want to have 5000 at the total and not the errenous 27 000
at the moment.

 

Any help would be appreciated!

 

 

 

  • Hi GreyMerchant ,

     

    The calculated logic of total value of [Combined Measure Food] measure works like what I explained in this post. Please refer.

     

    You can try the measure as follows. Make sure replace Table with the actual name of your table.

    New measure = SUMX(Table,[Combined Measure Food])

    This may give the same values in the rows, but the correct sum in total.

     

     

    Best regards

    Icey

     

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

5 Replies