Forum Discussion
How to use switch function to return 3 results?
- 2 years ago
dcheng029,
You were on the right path with SWITCH. The SWITCH ( TRUE() ) pattern is probably the most intuitive way to work with SWITCH, especially if you have multiple criteria within your different conditions.
Try:
SWITCH ( TRUE(), Table[Category Type] = "A" && Table[Calendar Days] <= 30 && Table[Identity 1] > 0, "YES", Table[Category Type] = "A" && Table[Calendar Days] <= 45 && Table[Identity 2] > 0, "YES", Table[Category Type] = "B" && Table[Business Days] <= 16, "YES", Table[Identity 1] > 0 && Table[Identity 2] > 0 && Table[Category Type] = "A" && Table[Calendar Days] <= 45, "YES", "NO" )
----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.
dcheng029,
You were on the right path with SWITCH. The SWITCH ( TRUE() ) pattern is probably the most intuitive way to work with SWITCH, especially if you have multiple criteria within your different conditions.
Try:
SWITCH (
TRUE(),
Table[Category Type] = "A" && Table[Calendar Days] <= 30 && Table[Identity 1] > 0, "YES",
Table[Category Type] = "A" && Table[Calendar Days] <= 45 && Table[Identity 2] > 0, "YES",
Table[Category Type] = "B" && Table[Business Days] <= 16, "YES",
Table[Identity 1] > 0 && Table[Identity 2] > 0 && Table[Category Type] = "A" && Table[Calendar Days] <= 45, "YES",
"NO"
)
----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)
P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.