Forum Discussion
doubt with DAX expression
- 4 years ago
Hi,
Inside ADDCOLUMNS,
the first two examples are using the measure, [Sales Amount]
the last example is using the expression, SUMX( Sales, Sales[Price] * Sales[Quantity] )
Please try to use the below if you want to write an expression when creating a table.
Categories Table =
ADDCOLUMNS (
SUMMARIZE ( 'Product', 'Product'[Category], 'Product'[Subcategory] ),
"@sales", CALCULATE ( SUMX ( Sales, Sales[Price] * Sales[Quantity] ) )
)Those two functions are different functions.
Sometimes, ALL and SUMMARIZE do the same job, sometimes do not.
My preference is writing like below. But it depends on the case.
Categories Table =
SUMMARIZECOLUMNS (
'Product'[Category],
'Product'[Subcategory],
"@sales", SUMX ( Sales, Sales[Price] * Sales[Quantity] )
)
Can you please sample pbix and also check once your datamodel.