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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Switch() Condition Error in Web Service

 

While writing a switch statement (Calculated Column) with multiple conditions, the condition is working fine in the Desktop App but upon publishing in the web service only the else condition is coming in the web service i.e pending condition. This happens when a refresh is happening from the database. Not sure, why it is happening but need the fix soon. 

IsApproved = SWITCH( TRUE(),
tableName[Review_Stat]="true" && tableName[trip_stat]="Completed" && tableName[Promotion]="N" && (tableName[status_val]="Exact Match" || tableName[status_val]="New store Match"), "Approved",
tableName[Review_Stat]="false" && tableName[trip_stat]="Completed","Rejected",
"Pending")



C2.jpg

 

C1.jpg

Status: Investigating

When I changed to Import mode and refresh the dataset, it still works fine in my side which is the same as the previous.

 

'Can we create it as a measure?'

If you want to use it in the slicer, measure is not supported to achieve it in Power BI.

 

Whether you can consider providing a sample test file without any sentive information that could reproduce this issue.

 

Best Regards,
Community Support Team _ Yingjie Li

Comments
v-yingjl
Community Support
Status changed to: Investigating

I have test in my environment when connecting to SQL server database under Direct Query mode, it works fine after refreshing the dataset in Power BI Service.

Desktop version: 2.100.1182.0 64-bit (December 2021)

vyingjl_0-1642584792773.png

 

Perhaps you can consdier providing your test environment like Desktop version, data source type, connection mode etc. about this issue for further.

 

Best Regards,
Community Support Team _ Yingjie Li

 

priyamsachan
New Member

Data Source: SQL Database, Import Mode
Version: 2.99.621.0 64-bit (November 2021)

Can we create it as a measure?

v-yingjl
Community Support
Status changed to: Investigating

When I changed to Import mode and refresh the dataset, it still works fine in my side which is the same as the previous.

 

'Can we create it as a measure?'

If you want to use it in the slicer, measure is not supported to achieve it in Power BI.

 

Whether you can consider providing a sample test file without any sentive information that could reproduce this issue.

 

Best Regards,
Community Support Team _ Yingjie Li