Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello everyone,
I'm quite new to Power Bi and I'm trying to using the SWITCH function instead of using nested IF statements.
I have a table with a the column Number of Sites that is a number. Now based on the site numbers I would like to display the installed software version. I'm using the switch function to compare the software versions over the different sites. If they match only one value should be display, if there are mixed versions it should be a default text displayed.
It seemed to work for a while but suddenly it doesn't and I don't knwo why.
Your help would be really appreciated.
Please find here my DAX and example data:
Software Version = SWITCH(
TRUE(),
isblank(SoftwareVersion[Software Version Site 1]), "No Information",
SoftwareVersion[Number Of Sites] = 1, SoftwareVersion[Software Version Site 1],
SoftwareVersion[Number Of Sites] = 2 && SoftwareVersion[Software Version Site 2] = SoftwareVersion[Software Version Site 1], SoftwareVersion[Software Version Site 1],
SoftwareVersion[Number Of Sites] = 3 && SoftwareVersion[Software Version Site 1] = SoftwareVersion[Software Version Site 2] && SoftwareVersion[Software Version Site 3], SoftwareVersion[Software Version Site 1],
SoftwareVersion[Number Of Sites] = 4 && SoftwareVersion[Software Version Site 1] = SoftwareVersion[Software Version Site 2] && SoftwareVersion[Software Version Site 3] && SoftwareVersion[Software Version Site 4], SoftwareVersion[Software Version Site 1],
SoftwareVersion[Number Of Sites] = 5 && SoftwareVersion[Software Version Site 1] = SoftwareVersion[Software Version Site 2] && SoftwareVersion[Software Version Site 3] && SoftwareVersion[Software Version Site 4] && SoftwareVersion[Software Version Site 5], SoftwareVersion[Software Version Site 1],
"Multiple Versions")
| Number of Sites | Software Version Site 1 | Software Version Site 2 | Software Version Site 3 | Software Version Site 4 | Software Version Site 5 |
| 1 | 7.2.10 a | ||||
| 1 | 7.2.9 a | ||||
| 1 | 7.2.10 a | ||||
| 2 | 7.2.10 a | 7.2.10 a | |||
| 3 | 7.2.10 e | 7.2.10 e | 7.2.10 e | ||
| 1 | 7.2.8 a | ||||
| 1 | 7.2.9 a | ||||
| 4 | 7.2.10 f | 7.2.10 f | 7.2.10 f | 7.2.10 e | |
| 2 | 7.2.9 a | 7.2.9 a | |||
| 3 | 7.2.10 d | 7.2.10 d | 7.2.10 d | ||
| 1 | 7.2.8 a | ||||
| 1 | 7.2.7 a | ||||
| 5 | 7.2.10 f | 7.2.10 f | 7.2.10 f | 7.2.10 f | 7.2.10 e |
Solved! Go to Solution.
Hi @Not-A-BI-Pro ,
According to your description, here is my solution.
You need to make the following changes in your formula.
Software Version =
SWITCH (
TRUE (),
ISBLANK ( 'Table'[Software Version Site 1] ), "No Information",
'Table'[Number Of Sites] = 1, 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 2
&& 'Table'[Software Version Site 2] = 'Table'[Software Version Site 1], 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 3
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 2]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 3], 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 4
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 2]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 3]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 4], 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 5
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 2]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 3]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 4]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 5], 'Table'[Software Version Site 1],
"Multiple Versions"
)
Final output:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ xiaosun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Not-A-BI-Pro ,
According to your description, here is my solution.
You need to make the following changes in your formula.
Software Version =
SWITCH (
TRUE (),
ISBLANK ( 'Table'[Software Version Site 1] ), "No Information",
'Table'[Number Of Sites] = 1, 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 2
&& 'Table'[Software Version Site 2] = 'Table'[Software Version Site 1], 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 3
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 2]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 3], 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 4
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 2]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 3]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 4], 'Table'[Software Version Site 1],
'Table'[Number Of Sites] = 5
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 2]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 3]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 4]
&& 'Table'[Software Version Site 1] = 'Table'[Software Version Site 5], 'Table'[Software Version Site 1],
"Multiple Versions"
)
Final output:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ xiaosun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you, that definitely solved the issue.
I've learned something today.
Best regards,
Not-A-BI-Pro
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.