Egghead
Egghead

Reputation: 7017

Error in dax formula

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

Upvotes: 0

Views: 141

Answers (1)

Rory
Rory

Reputation: 969

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.

Upvotes: 1

Related Questions