Forum Discussion
How would I conditional format this in PBI for a table?
- Anonymous2 years ago
Hi Anonymous ,
If you can get the deal stage in the current context, try this:
Measure = VAR __cur_stage = SELECTEDVALUE('Table'[Deal Stage]) VAR __days = SUM('Table'[Days Opened]) VAR __result = SWITCH( TRUE(), __cur_stage IN {5,6}, SWITCH( TRUE(), __days < 0 && __days >= -60, "Green", __days < -60 && __days >= -90, "Yellow", __days < -90 && __days >= -1000, "Red" ), __cur_stage = 4, SWITCH( TRUE(), __days < 0 && __days >= -30, "Green", __days < -30 && __days >= -60, "Yellow", __days < -60 && __days >= -1000, "Red" ), __cur_stage IN {2,3}, SWITCH( TRUE(), __days < 0 && __days >= -15, "Green", __days < -15 && __days >= -30, "Yellow", __days < -30 && __days >= -1000, "Red" ) ) RETURN __resultBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi Anonymous ,
If you can get the deal stage in the current context, try this:
Measure =
VAR __cur_stage = SELECTEDVALUE('Table'[Deal Stage])
VAR __days = SUM('Table'[Days Opened])
VAR __result =
SWITCH(
TRUE(),
__cur_stage IN {5,6},
SWITCH(
TRUE(),
__days < 0 && __days >= -60, "Green",
__days < -60 && __days >= -90, "Yellow",
__days < -90 && __days >= -1000, "Red"
),
__cur_stage = 4,
SWITCH(
TRUE(),
__days < 0 && __days >= -30, "Green",
__days < -30 && __days >= -60, "Yellow",
__days < -60 && __days >= -1000, "Red"
),
__cur_stage IN {2,3},
SWITCH(
TRUE(),
__days < 0 && __days >= -15, "Green",
__days < -15 && __days >= -30, "Yellow",
__days < -30 && __days >= -1000, "Red"
)
)
RETURN
__result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
- Anonymous2 years agoNot applicable
Trying this now! Thanks!!