Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Expression :
if condition is positive,
then
a= x-min(x)/target(x)-Min(x)
for example X= 1,2,3,4,5
Target =10
Any help would be greatly appreciated.
Hi @ShaRaj ,
Here are the steps you can follow:
1. Create calculated column.
logic =
var _minx=MINX(ALL('Table'),[Value])
return
IF(
'Table'[PN]="Positive",
DIVIDE('Table'[Value] -_minx , 'Table'[Target] -_minx),
DIVIDE('Table'[Value] -_minx , 'Table'[Target] +_minx))
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
hi ,
min of each category is what we need,not minimum of [value]
Hello @ShaRaj please try the same what @Anonymous told you but use this formula instead
logic =
var _minx=CALCULATE(min(value),allexcept(table,[category]))
return
IF(
'Table'[PN]="Positive",
DIVIDE('Table'[Value] -_minx , 'Table'[Target] -_minx),
DIVIDE('Table'[Value] -_minx , 'Table'[Target] +_minx))
To convert this formula to DAX, you can use the following expression:
a = IF( x > 0, (x - MIN(x)) / (target - MIN(x)), 0 )
This expression first checks if x is positive using the IF function. If it is positive, the formula calculates (x - MIN(x)) / (target - MIN(x)), and if it is not positive, it returns 0.
Remember me in prayers.
Farhad
"Positive" is in text format
yes,
Also I have different set of value for different category
for Example
PN Category Value Target
Positive Red 1 10
Positive Red 2 10
negative Red 3 10
negative Yellow 15 25
Negative Yellow 18 25
Negative Yellow 7 25
if PN is Positive do
A= x-min(x)/target(x)-Min(x)
else
A= x-min(x)/target(x)+Min(x)
This is the logic,For each i have to find new "A"
@ShaRaj Can you provide some more information on this. Are you saying you want to compute a for each value of x? So
x=1
1 - 1 / 10 - 1 = 1 - .1 - 1 = .9 - 1 = -.1
Or ?
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
12 | |
10 | |
6 |