Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Convert Volume Type on Data based on slicer selection

Hi Guys,

I have a requirement where I have to show values-based on conversions, that is multiplying it by a pre-defined value and displaying it in the table. This conversion should be performed based on a slicer selection.

For Eg:- The slicer has 2 volume types CM3 and Tons. On selecting Tons, it should convert the existing data and display the results in the Visual Table. But I am not sure how to display the Tons field in the slicer and convert the values based on this selection

Any help on this is highly appreciated

Thanks

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous,

    You can achieve this by creating a measure for volume and a separate table containing your filter values. E.g. something like this:

     

    volume_measure = SUM ('example_table'[volume])

     

    Unit

    CM3

    Tons

     

    The next step would be to create a measure that displays the converted value of "volume" corresponding to the selection made in the "Unit" slicer. You can achieve this by using SELECTEDVALUE and SWITCH as shown below:

     

    volume_converted =
    SWITCH (
        SELECTEDVALUE ( unit_table[Unit] ),
        "CM3", 'example_table'[volume_measure] * <some multiplier value>,
        "Tons", 'example_table'[volume_measure] * <some multiplier value>
    )

     

    You can now use the "volume_converted" measure to display the value based on the filter selection. You need to enable single-select on your slicer since the measure will not return anything unless a value is selected.Hope this helps!

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    You can achieve this by creating a measure for volume and a separate table containing your filter values. E.g. something like this:

     

    volume_measure = SUM ('example_table'[volume])

     

    Unit

    CM3

    Tons

     

    The next step would be to create a measure that displays the converted value of "volume" corresponding to the selection made in the "Unit" slicer. You can achieve this by using SELECTEDVALUE and SWITCH as shown below:

     

    volume_converted =
    SWITCH (
        SELECTEDVALUE ( unit_table[Unit] ),
        "CM3", 'example_table'[volume_measure] * <some multiplier value>,
        "Tons", 'example_table'[volume_measure] * <some multiplier value>
    )

     

    You can now use the "volume_converted" measure to display the value based on the filter selection. You need to enable single-select on your slicer since the measure will not return anything unless a value is selected.Hope this helps!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous Thanks a lot for your help, you're Idea really works for me.