Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Not-A-BI-Pro
New Member

Cannot convert value 'x' of type Text to type True/False when using Switch

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 SitesSoftware Version Site 1Software Version Site 2Software Version Site 3Software Version Site 4Software Version Site 5
17.2.10 a    
17.2.9 a    
17.2.10 a    
27.2.10 a7.2.10 a   
37.2.10 e7.2.10 e7.2.10 e  
17.2.8 a    
17.2.9 a    
47.2.10 f7.2.10 f7.2.10 f7.2.10 e 
27.2.9 a7.2.9 a   
37.2.10 d7.2.10 d7.2.10 d  
17.2.8 a    
17.2.7 a    
57.2.10 f7.2.10 f7.2.10 f7.2.10 f7.2.10 e
1 ACCEPTED SOLUTION
v-xiaosun-msft
Community Support
Community Support

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:

vxiaosunmsft_0-1667281792829.png

 

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.

View solution in original post

2 REPLIES 2
v-xiaosun-msft
Community Support
Community Support

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:

vxiaosunmsft_0-1667281792829.png

 

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 @v-xiaosun-msft 

 

Thank you, that definitely solved the issue.

I've learned something today.

 

Best regards,

Not-A-BI-Pro

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors