Forum Discussion
How to make the total amount display correctly ?
Hi All
Hi Anonymous ,
Based on your description, you can modify the measure like this:
AMT_OH = VAR tab = SUMMARIZE ( 'Table', 'Table'[Stock Code], 'Table'[Unit Cost], 'Table'[Avail], "RE", SUM ( 'Table'[Unit Cost] ) * SUM ( 'Table'[Avail] ) ) RETURN SUMX ( tab, [RE] )Attached a sample file in the below, hopes to help you.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- amitchandak
Super User
Anonymous , They are from same table try like
AMT_OH = SUMX(INVC, INVC[Unit Cost])*SUM(INVC[Avail])
- v-yingjl
Community Support
Hi Anonymous ,
Based on your description, you can modify the measure like this:
AMT_OH = VAR tab = SUMMARIZE ( 'Table', 'Table'[Stock Code], 'Table'[Unit Cost], 'Table'[Avail], "RE", SUM ( 'Table'[Unit Cost] ) * SUM ( 'Table'[Avail] ) ) RETURN SUMX ( tab, [RE] )Attached a sample file in the below, hopes to help you.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Thank you very much , i unable to understand your script. can you explain a bit ?
- v-yingjl
Community Support
Hi Anonymous ,
Sure. The variable extract the source table and add a new column for it to calculate [unit cost] * [avil] for current context, it could be more simple like this:
a = ADDCOLUMNS ( 'Table', "RE", [Unit Cost] * [Avail] )You can use the above formula to replace the variable and create a new calculated table to check which value it returns that should be the same as the initial formula.
For SUMX(), calculate the sum value for the field in the variable table which should be look like the same as the initial table and you will get the expected output.
In addition, you can refer these documents about the dax functions that I quoted:
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.