Forum Discussion
Problems with syntax in combination with Related
Thank you very much. I have the feeling I am almost there. This is how I used it (translated into Dutch to the actual situation
Hi, BartVlek
In Power BI Desktop, I need to create a calculated column as below.
CostPrice =
IF(
RELATED(discount[percentage]) = 0,
total[PAMP],
total[Amount]*RELATED(discount[percentage])
)
While in Dax Studio, you need to use the following formula.
EVALUATE
ADDCOLUMNS(
total,
"CostPrice2",
IF(
RELATED(discount[percentage]) = 0,
total[PAMP],
total[Amount]*RELATED(discount[percentage])
)
)
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- BartVlek6 years agoHelper II
Thanks again. When I run the transformed script into PBI I get the following error-message:
The syntax for 'totaal' is incorrect. (DAX(IF( RELATED(korting[kortingspercentage]) = 0. totaal[PAMP], totaal[bedrag]*RELATED(korting[kortingspercentage])))).
This is the script I used:
KOSTPRIJS-CORR =
IF(
RELATED(korting[kortingspercentage]) = 0,
totaal[PAMP],
totaal[bedrag]*RELATED(korting[kortingspercentage])
)Thanks again,
Bart