Forum Discussion

jaime_blackwell's avatar
6 years ago
Solved

GROUPBY Returning an Error, Please Help.

Hi Community,

 

I'm having difficulty creating a measure using DAX. I want to group records by DATE and get TOTAL DECIMAL TIME of each group.

 

So far I'm using the GROUPBY function, but I'm receiving an error indicating that I've given the function 2 columns. I believe I have only given one column. 

 

Can you please assist?

 

My code:

 

=GROUPBY(Table4
, Table4[Date]
,"TotalTimeForDay"
, SUMX( CURRENTGROUP(), Table4[Decimal Time])
)

 

My error:

Calculation error in measure 'Table4'[Test1]: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

 

 

Thank you!

  • Anonymous's avatar
    Anonymous
    6 years ago
    [Total Time] = SUM( T[Decimal Time] )
    
    [Billable Time] =
    var __breakTime = 1 * time(0, 30, 0)
    var __result =
    	SUMX(
    		SUMMARIZE(
    			T,
    			T[UserID],
    			T[Date]
    		),
    		var __time = [Total Time]
    		var __deduction = ( __time > 5 ) * __breakTime
    		return
    			__time - __deduction
    	)
    return
    	__result
    	
    [Billable Time %] =
    	DIVIDE(
    		[Billable Time],
    		[Total Time]
    	)

     

    Best

    D

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    Table = 
    ADDCOLUMNS( 
    	VALUES( T[Date] ),
    	"TotalTimeForDay",
    		CALCULATE(
    			SUM( T[Decimal Time] )
    		)
    )
    

     

    Best

    D

    • jaime_blackwell's avatar
      jaime_blackwell
      Icon for Helper I rankHelper I

      Hi D,

       

      Thanks so much for your response. I have keyed the below into my measure however I still receive the same error. Do you know why this is occuring?

       

      Code:

      =ADDCOLUMNS(VALUES(Table4[Date]), "TotalTimeForDay", CALCULATE(SUM(Table4[Decimal Time])))

       

      Error:

      Calculation error in measure 'Table4'[Test1]: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

       

      Thank you.

       

      • Anonymous's avatar
        Anonymous
        Not applicable
        It's not a measure. It's a calculated table.

        Best
        D