Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

General question on Custom Slicers

Hello

 

I have some general questions on custom slicers:

 

1) To create a slicer with custom values, we need to create a table with the values, right?

2) To capture the selection of the slicer, do I need to always name a "var _slicerselection SELECTEDVALUE()"? Or can I use the SELECTEDVALUE() in other formulas across my report without having to set up a var?

3) To enable a slicer selection to filter other tables, do I need to use a flag column or is there any other way?

4) To enable a slicer selection to be a condition on other tables (such as if slicer selection = 1, then calculate Col1/Col2 but if slicer selection = 2, then calculate Col1-Col2), do I still need a variable?

 

I am trying SWITCH(SELECTEDVALUE(Slicer[SlicerValue]),1,Table1[Col1]-Table1[Col2],2,Table1[Col1]/Table1[Col2]) but it does not display anything!

 

Thank you!

  • Hi Anonymous 

     

    Please see answers below:

    1) Correct

    2) You can use the variable in any of the measures you need no need to have a specific one for the full report

    3) Since it's a custom slicer you need to have some way of connecting the data with the slicer table so you need to make use of SWTICH function for example

    4) The use of the variable is for you not to rewrite code every time in this case using a swithc there is no need for that because the first argument can be that value

    SWITCH(SELECTEDVALUE(Slicer[SlicerValue]),
    1,SUM(Table1[Col1])-SUM(Table1[Col2]),2,SUM(Table1[Col1])/SUM(Table1[Col2]) )

     

    You need to use it in a metric and you cannot reference columns directly they need to be aggregated, has showned above with the sum.

1 Reply

  • Hi Anonymous 

     

    Please see answers below:

    1) Correct

    2) You can use the variable in any of the measures you need no need to have a specific one for the full report

    3) Since it's a custom slicer you need to have some way of connecting the data with the slicer table so you need to make use of SWTICH function for example

    4) The use of the variable is for you not to rewrite code every time in this case using a swithc there is no need for that because the first argument can be that value

    SWITCH(SELECTEDVALUE(Slicer[SlicerValue]),
    1,SUM(Table1[Col1])-SUM(Table1[Col2]),2,SUM(Table1[Col1])/SUM(Table1[Col2]) )

     

    You need to use it in a metric and you cannot reference columns directly they need to be aggregated, has showned above with the sum.