0
votes

Good Day all.

I really hope someone can assist with this. The following code works great in DaxStudio and returns a topn table.

evaluate TOPN(10,SUMMARIZE(factDailyPlay,factDailyPlay[PlayerAccountNumber],"Top10",SUM(factDailyPlay[ActualWin])),[Top10],0)

What I am trying to return in my model though is sum of those top 10 values as a single scalar value of that topn table.

I keep getting the following error. The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

Thanks

1

1 Answers

1
votes

Try using:

EVALUATE
ROW (
    "Total", SUMX (
        TOPN (
            10,
            SUMMARIZE (
                factDailyPlay,
                factDailyPlay[PlayerAccountNumber],
                "Top10", SUM ( factDailyPlay[ActualWin] )
            ),
            [Top10], 0
        ),
        [Top10]
    )
)

Basically the below expression calculates the sum you require.

SUMX (
    TOPN (
        10,
        SUMMARIZE (
            factDailyPlay,
            factDailyPlay[PlayerAccountNumber],
            "Top10", SUM ( factDailyPlay[ActualWin] )
        ),
        [Top10], 0
    ),
    [Top10]
)