Error in dax formula

161 views Asked by At

i'm new to dax. im trying to sum the amount of fatalities per year. My formula:

= SUMMARIZE (
    'TableCrash',
    'TableCrash'[Year],
    "Fatal", SUM ( 'TableCrash'[Fatalities] )
)

- example:

SUMMARIZE(<table>, <groupBy_columnName>[, <groupBy_columnName>]…[, <name>, <expression>]…)

Source

1

There are 1 answers

0
Rory On BEST ANSWER

There isn't anything wrong with your formula. The problem is how you are using it. Because it returns a table you would usually incorporate this snippet into a larger formula. You can install DAX Studio into Excel to test these snippets. In this case you would execute:

EVALUATE
 (
    SUMMARIZE (
        'TableCrash',
        'TableCrash'[Year],
        "Fatal", SUM ( 'TableCrash'[Fatalities] )
    )
)

But if you have a table that contains Year and Fatalities you don't need any formula to calculate sum of Fatalities. Try to drop both fields into a Power View or pivot table and Fatalities will sum automagically.