Forum Discussion
DAX Evaluate Issue
- 6 years ago
Try this. Note that you were using Cateogry in the definition of table1 and Category when referencing the column in table H
DEFINE VAR table1 = UNION ( ROW ( "Cateogry", "A", "Value", INT ( 1 ) ), ROW ( "Cateogry", "A", "Value", INT ( 2 ) ), ROW ( "Cateogry", "A", "Value", INT ( 3 ) ), ROW ( "Cateogry", "B", "Value", INT ( 4 ) ), ROW ( "Cateogry", "B", "Value", INT ( 5 ) ), ROW ( "Cateogry", "C", "Value", INT ( 6 ) ), ROW ( "Cateogry", "c", "Value", INT ( 7 ) ) ) --EVALUATE table1 VAR H = SUMMARIZE ( table1, ROLLUP ( [Cateogry] ), "Sum of Value", SUMX ( table1, [Value] ), "Max of Value", MAXX ( table1, [Value] ), "Average of Value", FIXED ( AVERAGEX ( table1, [Value] ), 1 ) ) EVALUATE HPlease mark the question solved when done and consider giving kudos if posts are helpful.
Cheers

Try this. Note that you were using Cateogry in the definition of table1 and Category when referencing the column in table H
DEFINE
VAR table1 =
UNION (
ROW ( "Cateogry", "A", "Value", INT ( 1 ) ),
ROW ( "Cateogry", "A", "Value", INT ( 2 ) ),
ROW ( "Cateogry", "A", "Value", INT ( 3 ) ),
ROW ( "Cateogry", "B", "Value", INT ( 4 ) ),
ROW ( "Cateogry", "B", "Value", INT ( 5 ) ),
ROW ( "Cateogry", "C", "Value", INT ( 6 ) ),
ROW ( "Cateogry", "c", "Value", INT ( 7 ) )
)
--EVALUATE table1
VAR H =
SUMMARIZE (
table1,
ROLLUP ( [Cateogry] ),
"Sum of Value", SUMX ( table1, [Value] ),
"Max of Value", MAXX ( table1, [Value] ),
"Average of Value", FIXED ( AVERAGEX ( table1, [Value] ), 1 )
)
EVALUATE
H
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers ![]()
- HarsimranPWRBI6 years ago
Helper I
Hi AlB ,
Does that mean only Iteration function can be used to refer column for aggregation?
Thanks,
Harry
- AlB6 years ago
Community Champion
If the table is "dynamic", or "virtual" (you create it within the code), you cannot reference the column in the usual way as with "actual" existing tables, you have to go with
SUMX ( VirtualTableName, [ColumnName] )
vs the usual
SUM ( ActualTableName, ActualTableName[ColumnName] )
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers

- HarsimranPWRBI6 years ago
Helper I