0

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

smckechnie
  • 79
  • 7

1 Answers1

1

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]
)
alejandro zuleta
  • 13,962
  • 3
  • 28
  • 48
  • Thank you, Alejandro. Exactly what I was looking for. Any Idea how I may use same period last year in that dax statement. – smckechnie Mar 16 '17 at 05:40
  • Can you please explain the logic of that code? What is your idea of combinations of TOPN10 and especially `[Top10], 0` ? – Przemyslaw Remin Dec 20 '19 at 17:17