Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I am new-ish to creating columns in the Query, and can use help finding the best way to create this calculation. This is my data and range:
Project | RATE | APE | CostDiff | CostHealth |
1 | $156.60 | $145.67 | -$10.93 |
|
2 |
| $29.80 |
|
|
3 | $57.26 | $57.20 | -$0.06 |
|
4 | $16.51 | $21.24 | $4.73 |
|
5 | $52.48 | $54.70 | $2.22 |
|
6 |
| $19.17 |
|
|
7 | $59.01 | $59.00 | -$0.01 |
|
8 | $13.36 | $13.40 | $0.04 |
|
9 | $121.50 | $147.74 | $26.24 |
|
10 | $49.14 | $49.14 | $0.00 |
|
11 | $12.62 | $12.55 | -$0.07 |
|
12 |
| $150.63 |
|
|
13 |
| $165.00 |
|
|
14 | $11.80 | $12.40 | $0.60 |
|
15 | $49.13 | $57.09 | $7.96 |
|
APE <$25: +/- 20% variance to RATE |
APE $25 - $100: +/- $5M variance to RATE |
APE >$100: +/- $20M variance to RATE |
Traffic Light Conditions:
if RATE <25 AND CostDiff >(RATE*.2) = Yellow, OR CostDiff <(RATE*.2) = Green
if RATE between 25-100 AND CostDiff is >5 = Yellow, else <5 = Green
if RATE <100 AND CostDiff >20 = Yellow, else <20 = Green
I've already calculated the difference between the RATE and the APE (CostDiff); now I need to take that difference and apply the variance allowed based on the APE, and have the CostHealth column return Green or Yellow to feed my traffic light. I believe my pseudo code for the traffic light conditions is correct, but cannot test that assumption.
Solved! Go to Solution.
Hi @rosamhernandez1 ,
We can add two conditional columns.
Then we add three custom columns.
Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @rosamhernandez1 ,
Based on your description, we can create three columns.
CostHealth = SWITCH(TRUE(),
[RATE]<25 && [CostDiff]>[RATE]*2,"Yellow",
[CostDiff]<[RATE]*2,"Green",
[RATE]>=25 && [RATE]<=100 && [CostDiff] >5,"Yellow",
[CostDiff]<5,"Green",
[RATE]<100 && [CostDiff]>20,"Yellow",
[CostDiff] <20,"Green")
variance_max =
SWITCH(TRUE(),
[APE]<25,[RATE]+ [RATE] * 0.2,
[APE] >=25 && [APE]<=100,[RATE]+5,
[APE]>100,[RATE]+20)
variance_min =
SWITCH(TRUE(),
[APE]<25,[RATE]- [RATE] * 0.2,
[APE] >=25 && [APE]<=100,[RATE]-5,
[APE]>100,[RATE]-20)
Then the result is as follows.
If I have misinterpreted your needs, please clarify in a follow-up response, preferably with an example of your desired outcome.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thank you, I am not familiar with DAX and have been using M query to add columns as of now, is there a way to translate this into M?
Hi @rosamhernandez1 ,
We can add two conditional columns.
Then we add three custom columns.
Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
106 | |
75 | |
44 | |
39 | |
33 |
User | Count |
---|---|
165 | |
90 | |
65 | |
46 | |
43 |