Advance with Assist shares quick solutions to common challenges encountered by the InterWorks Assist on-demand team.
Question: I’m needing to split Sales out for each member of a dimension to have separate measures. What’s the best way to go about that?
This question comes up from time to time when someone has a dimension that separates out a single measure, but the desired analysis and report layout needs a separate measure. Using Superstore, let’s say you want the Sales for each Segment. You’d create a calculated field with the logic below:
Now, to create the other two, since Superstore has Consumer, Home Office and Corporate Segments, you may go over to your Data pane and right-click the field, select Duplicate, and change the name and calculation for the next calculation. I know I’ve done this before:
Streamline Duplicate Calculations
But did you know that you can do all three from a single calculated field editor? Here’s how. Start by creating the above calculated field again, but this time, put all three in the editor. Separate each with commenting in the calculation. For example: // Consumer Sales
Your editor will now look like this:
Now here’s where this gets fun. Highlight the first comment and calculation, click the highlighted section and then drag it to your Data pane. Then you instantly have a named calculation with the logic you pulled over:
No more duplicating, renaming copies, etc. Just duplicate the logic you need, pull it over, and you instantly have your calculation!