Forum Discussion

Brynieboy's avatar
Brynieboy
Regular Visitor
6 years ago
Solved

Help with an error in formula

Hi,   I have a formula that works correctly in excel, however when I recreate this in Power Bi I get the following error message "The SUM function only accepts a column reference as the argument nu...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Brynieboy 

    Due to I don’t know your data, I make a sample in excel just like yours.

    I tried your dax in Excel and get the result as below:

    I import the excel into the desktop and use calculated column.

     

    Commission2 = 
    VAR _NewSold = SUM(Sheet1[New Sold])
    VAR _UsedSold = SUM(Sheet1[Used Sold])
    VAR _NewTarget= SUM(Sheet1[New Target])
    VAR _UsedTarget = SUM(Sheet1[Used Target])
    VAR _NewT80 = SUM(Sheet1[New 80%])
    VAR _UsedT80 = SUM(Sheet1[Used 80%])
    VAR _AllSold= SUM(Sheet1[New Sold])+SUM(Sheet1[Used Sold])
    VAR _AllTarget= SUM(Sheet1[New Target])+SUM(Sheet1[Used Target])
    return
    IF (
        AND (_NewSold >= _NewTarget ,_UsedSold >= _UsedTarget),
          _AllSold*150-_AllTarget*50 ,
        IF (
            OR (
                AND (_NewSold >=_NewTarget,_UsedSold >_UsedT80 ),
                AND (_NewSold >=_NewT80, _UsedSold>= _UsedTarget)
            ),
           _AllSold*100,
           _AllSold*25
        )
    )

     

    Result:

    You can download the pbix file form this link:

    https://qiuyunus-my.sharepoint.com/:u:/g/personal/tongzhou_qiuyunus_onmicrosoft_com/EWyRKsHutiRGgi1wdImdDxsBTY_mj6IW4v3Ro1ZqYOfwSA?e=2HoFuB

     

    Best Regards,

    Rico Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.