Dominique Feteau Posted July 22, 2019 Share Posted July 22, 2019 What I'd like to do is use a drop-down list that consists of two values, kg or lb, and when one is selected, have it run a calculation to convert a column (or multiple columns) from one to the other. The column is now in pounds. If the drop down is at "lb", then do nothing and use the value as-is. If it changes to "kg", then multiply each value in the column by 0.45359237. It sounds easy in my head but I'm sure that it isn't. Any help would be appreciated. Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted July 23, 2019 Share Posted July 23, 2019 You can create a calculated column with below expression whose values are calculated based on the selection in drop down If(DocumentProperty("dropDownProperty")="kg",[columnName],[columnName] * 0.45359237) Link to comment Share on other sites More sharing options...
Kirsten Smith (she/her) Posted July 23, 2019 Share Posted July 23, 2019 Maybe an easier way to do this would be to create Action controls instead of a drop down list. Add a new column in your data table that contains the converted value, then create two bookmarks, one that shows the lb value and one that shows the kg value. Next, create two Action controls, one for lb and one for kg, and have the action be the corresponding bookmark. Then you can click on one control to show the lb column, then click on the other control to show the kg column. Link to comment Share on other sites More sharing options...
Dominique Feteau Posted July 23, 2019 Author Share Posted July 23, 2019 KirstenS I thought about this but I actually multiple columns I want to use this on. Shandilya's option works better for that. Thanks for the idea though. :) Link to comment Share on other sites More sharing options...
Dominique Feteau Posted July 23, 2019 Author Share Posted July 23, 2019 Thanks Shandilya I took your idea and came up with this within the visualization I was working on. I had a function that I created in another report and just brought it over here. CASE WHEN DocumentProperty("MassConversion")="kilograms" then cnv_LBtoKG(Sum([WEIGHT_LB])) ELSE Sum([WEIGHT_LB]) END as [WEIGHT] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now