Forum Discussion
SWITCH Function not giving correct result
- 4 years ago
Hi,
If you are creating a calculated column (not measure) in the table, please try the below to create a new column.
ProjectCategory = VAR Revenue = XXX[YYY] RETURN SWITCH ( TRUE (), Revenue >= 50, "C", Revenue <= 50, "S" ) - 4 years ago
Anonymous
Thank you for the clarification. Unfortunately it doesn't work like this. You need to create a calculated column as suggested by Jihwan_Kim and then use it to slice you visual. Then you can create a measure such as COUNTROWS ( TableName ) or just drag the Project column in the Values of the visual ans summarize it by count or distinctcount as needed.
- Anonymous4 years ago
Hi Anonymous ,
Please try below steps:
1.Add a new column to table
Project Catagory = SWITCH ( TRUE, 'Table'[Planned Revenue] <= 50, "S", 'Table'[Planned Revenue] > 50, "C" )2.Visualize the data with pie chart
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey 🙂 thank you very much for your suggestion! But it still doesn't works 😞
Hi,
Please share your pbix file's link here, and then I can try to look into it to come up with a more accurate solution for your data model.
Thanks.
- Anonymous4 years agoNot applicable
Thank you very much! But I'm not allowed to share the link because of the confidential data... 😞