Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi team,
I’m trying to create a measure, but I’ve some issues with syntax. Could you be able to help?
I need the following measure:
Measure % = (1 – ABS((cost1 – cost2)/cost1)*100 and if cost2>= 2*cost1 or if cost1= 0, the result should be 0.
The data should like:
Cost1 | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
Cost2 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
Measure % | 50 | 75 | 100 | 75 | 50 | 25 | 0 |
Thank you.
Solved! Go to Solution.
Hi @nasbkrv
you can do it like this:
Measure % =
VAR _Cost1 = MIN('Table'[Cost1 ])
VAR _Cost2 = MIN('Table'[Cost2 ])
RETURN
IF(_Cost2 >= 2 * _Cost1 || _Cost1 = 0 ,
0 ,
1 - ABS((_Cost2 - _Cost1) / _Cost1)
)
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
Hi @nasbkrv
you can do it like this:
Measure % =
VAR _Cost1 = MIN('Table'[Cost1 ])
VAR _Cost2 = MIN('Table'[Cost2 ])
RETURN
IF(_Cost2 >= 2 * _Cost1 || _Cost1 = 0 ,
0 ,
1 - ABS((_Cost2 - _Cost1) / _Cost1)
)
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
User | Count |
---|---|
106 | |
88 | |
82 | |
76 | |
73 |
User | Count |
---|---|
112 | |
103 | |
96 | |
74 | |
67 |