Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in BI by (17.6k points)

I tried using group by DAX function in PowerBI as Measure, New Column, New Table but I get an error in validating the function,

New Table = GROUPBY(

            'tab1',

            'tab1'[color],

            "Group By color",

            sum('tab1'[count_lables])

          )

Error : Function 'GROUPBY' scalar expressions have to be Aggregation functions over CurrentGroup(). The expression of each Aggregation has to be either a constant or directly reference the columns in CurrentGroup().

1 Answer

0 votes
by (47.2k points)
  • You need to use an aggregation function over a group, you are using SUM function which doesn't sum values over any group. In your case you need to use SUMX aggregation function with CURRENTGROUP() option. The CURRENTGROUP determines the groups that must be added based on the current row.

  • use the below expression:

New Table = GROUPBY ( tab1, tab1[color], "Group by color", SUMX ( CURRENTGROUP (), tab1[count lables] ) )

Related questions

Browse Categories

...