Forum Discussion

Shamatix's avatar
Shamatix
Post Partisan
7 years ago
Solved

SUM function only accepts column reference as an Argument

Hey fellow power bi users,   I am getting the following error:  SUM function only accepts column reference as an Argument   My DAX is as follow: Column = SUM(IF(AND(WEEKNUM(Data[dte_invduedate...
  • v-juanli-msft's avatar
    7 years ago

    Hi Shamatix

    it seems you write a column to put the formula which should be put in a measure.

    If you'd like a column more than a measure, you could write columns as below:

     

    total amount for all row

    Column =
    IF (
        AND (
            WEEKNUM ( Data[dte_invduedate], 2 ) >= WEEKNUM ( TODAY (), 2 ),
            YEAR ( Data[dte_invduedate] ) <= YEAR ( TODAY () )
        ),
        SUM ( Data[TotalAmount] ),
        0
    )
    

    total amount for each row

    Column =
    IF (
        AND (
            WEEKNUM ( Data[dte_invduedate], 2 ) >= WEEKNUM ( TODAY (), 2 ),
            YEAR ( Data[dte_invduedate] ) <= YEAR ( TODAY () )
        ),
        CALCULATE ( SUM ( Data[TotalAmount] ) ),
        0
    )
    

    Best Regards

    Maggie