Forum Discussion
Help with an error in formula
- Anonymous6 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:
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.
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:
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.