Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply

DAX Evaluate Issue

I'm trying to evaluate below expression in DAX Studio but not able to evaluate variable H.

Please Let me know if I'm missing something,

 

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 ( [Category]),
    "Sum of Value", SUM ( [Value] )
    "Max of Value", MAX ( [Value] ),
    "Average of Value", FIXED ( AVERAGE ( [Value] ), 1 )
     )

EVALUATE H

Thanks,

Harry

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @HarsimranPWRBI 

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  Datanaut

View solution in original post

4 REPLIES 4
AlB
Community Champion
Community Champion

Hi @HarsimranPWRBI 

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  Datanaut

Hi @AlB ,

 

Does that mean only Iteration function can be used to refer column for aggregation?

 

Thanks,

Harry

@HarsimranPWRBI 

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  Datanaut

Hi @AlB ,

 

What about this one then .

 

 

Thanks,

Harry

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.