Forum Discussion
Incorrect Measure Total
- 8 years ago
Hi,
The SUMX() portion of the formula should be something like this
=SUMX(SUMMARIZE(VALUES(Rebates[Account/Group]),[Account/Group],"ABCD",SUM(Sales value final)*AVERAGE(Rebates[% turnover])),[ABCD])
Include the curency symbol in the underlines portion.
If this formula does not help, then share the link from where i can download your PBI file.
- Ashish_Mathur6 years agoSuper User
You are welcome. If my reply helped, please Accept it as Solution.
- calerof6 years agoImpactful Individual
Sure it did! I would if I knew how!
As it was an already solved question I don't find where to mark it as solved. Please show me.
Thanks again.
Fernando
- calerof6 years agoImpactful Individual
Hi Ashish_Mathur ,
I'm running into problems with my actual data model. The data I posted here was a dummy for the purpose of the excercise. In my code I'm using variables and still don't get the correct total amount for the measure.
Comision = VAR Sales= [Sales Total] VAR Margin = [Margin Total] VAR Commission = SWITCH( TRUE(), Sales >= 200000 && Sales < 250000, 0, Sales>= 250000 && Margin >= 0.52 && Margin < 0.56, 0.01, Sales>= 250000 && Margin < 0.60, 0.015, Sales>= 250000 && Margin >= 0.6, 0.02, 0 ) VAR BaseBonus = SWITCH( TRUE(), Sales>= 200000 && Sales < 250000, 1000, 0 ) VAR CommissionAmount = Sales * Commission + BaseBonus VAR ComisTotal = SUMMARIZE( VALUES( OCRD[SlpCode] ), OCRD[SlpCode], "ComisTot", MAX( 0, CommissionAmount ) ) RETURN SUMX( ComisTotal, [ComisTot] )This is the result I get with the measure above:
I did the same trick with the excercise to try to understand what's wrong with my measure, and modified yours as follows:
Excess2 = VAR TotalAmount = SUM( Sales[Amount] ) VAR ExcessAmount = TotalAmount - 1000 VAR ExcessTotal = SUMMARIZE( VALUES( Customer[Slpcode] ), Customer[Slpcode], "ABCD", MAX( 0, ExcessAmount ) ) RETURN SUMX(ExcessTotal,[ABCD])Which follows the same logic as your proposed solution, and that worked correctly, but not with these modifications.
Here's the pbix file.
Do you know why? Could you please help?
I appreciate your help a lot.
Best regards,
Fernando