Exchange parts of a measure in a dynamic way

Hello, i have a question regarding measures, to be more precise if it is possible to exchange parts of a measure in a dynamic way.

Background:
I am working with a database of global ships. In showing the worldfleet development, you can use different dimensions. You could show the worldfleet in number of ships, but also for instance by the cargo volume of vessels, or by the liquid volume of vessels in cubic metres. For these dimensions, there are separate columns, so they are not together in one column.
Here are two examples of my measures. The first one is to calculate the fleet in number of ships, the second one is to calculate the fleet in total cargo volume. I have a total of 5 dimensions.

``````Ships in service =
CALCULATE([Total number of ships];
Filter( values(tblShip[Due_or_Delivered] ) ; tblShip[Due_or_Delivered] <= MAX(Dates[Date] ));
Filter( values(tblShip[Scrap_or_Loss_Date] ) ; or(tblShip[Scrap_or_Loss_Date] >= MIn( Dates[Date]); isblank(tblShip[Scrap_or_Loss_Date]))))

DWT in service =
CALCULATE([Total DWT];
Filter( values(tblShip[Due_or_Delivered] ) ; tblShip[Due_or_Delivered] <= MAX(Dates[Date] ));
Filter( values(tblShip[Scrap_or_Loss_Date] ) ; or(tblShip[Scrap_or_Loss_Date] >= MIn( Dates[Date]); isblank(tblShip[Scrap_or_Loss_Date]))))
``````

What I would like to know is, if there is a functionality to replace [Total number of ships] with [Total DWT] in a dynamic way (choosing from a list or button for instance), instead of having to duplicate the measures for each vessel dimension? I would like to use this to have only one chart, and being able to change the dimension, after which the chart would use the ‘new’ dimension and be updated automatically.

I would be grateful for any help to get me into the right direction.

Regards, Jeffrey van der Gugten

Yes definitely, all you need to use is SWITCH( TRUE() technique.

See here for exactly how to do this.

The scenario here is only slightly different to yours but it’s exactly the same technique.

Using this technique you can feed different measures into one single measure and then have it determined by a selection.

Here the full workshop at Enterprise DNA Online.

Thanks
Sam

Hello there, many thanks for the quick reply. I used the Switch function, after looking at a couple of suggested video’s, and it works perfectly ! thanks again for the support.