Forum Discussion

Benjamin123's avatar
Benjamin123
New Member
4 years ago
Solved

Using Slicers in New Measures

Hi all

 

I have created a variance measure but want one of the variables to be a value from a slicer (multi select) 

 

is this possible? 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Benjamin123 ,

     

    You will need to create an independent version table as slicer.

    Variance = CALCULATE(sum(DataFlip[Value]),filter(DataFlip,DataFlip[Version]in values(slicer[version])))

    If I misunderstood your meaning, please show some sample data and expected result.

     

    Best Regards,

    Jay

     

3 Replies

  • Benjamin123 , If you need a measure as slicer, You need create an independent table with all possible values or based on range.

     

    find the example of range. In case of each value, you need to have all values and = join with an independent table

    Dynamic Segmentation Bucketing Binning
    https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1387187#M626


    Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

    • Benjamin123's avatar
      Benjamin123
      New Member

      Hey amitchandak thanks alot for the reply! 

       

      Apologies but I don't think I explained myself very well... I am using the following to create a variance, however I am using a slicer on the report which I would like to overide the latter part of the formula (P8 Latest View)

       

      Variance = -CALCULATE(sum(DataFlip[Value]),KEEPFILTERS(DataFlip[Version]="Latest View"))+CALCULATE(sum(DataFlip[Value]),KEEPFILTERS(DataFlip[Version]="P8 Latest View"))
       
      The data table used has the following columns in use here: 
      - Version ("Latest View")
      - Value (Cost)
       
      We have multiple versions and a slicer to select which one we want to look at versus the "Latest View". I want variance calculation to be able to use the Slicer value selected ("P8 Latest View" etc.). 
       

       

      Is there a way to change this part of the formula to select the value from the filter that isnot "Latest View"? 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Benjamin123 ,

         

        You will need to create an independent version table as slicer.

        Variance = CALCULATE(sum(DataFlip[Value]),filter(DataFlip,DataFlip[Version]in values(slicer[version])))

        If I misunderstood your meaning, please show some sample data and expected result.

         

        Best Regards,

        Jay