Forum Discussion

ShaelynFrench's avatar
3 years ago
Solved

Slice Gauge Visual with Measure

Hi,

 

I have a measure ("ProfDept") that determines what department an individual is currently in based on the slicer date. This measure cannot be added to the fact table as a calculated column since it is determined by the date of the report you are looking at. I have used all of the tricks to be able to use this measure in a slicer. It works great for matrix visuals. However, if I try to use the same tricks on a gauge visual or a clustered column visual it does not work. In this picture, the matrix is sliced to show one department, but the gauge shows everyone:

 

 

Is there a way to be able to filter the gauge visual using a measure?

  • v-jingzhang's avatar
    v-jingzhang
    3 years ago

    Hi ShaelynFrench

     

    Please try these new measures in your Gauge visual. 

    2020 Sales Measure = 
    VAR Selection = SELECTEDVALUE('Sales Class'[Selection])
    var _table = SUMMARIZE('Data','Data'[Customer],"_2020_sales",SUM('Data'[2020 Sales]),"_sales_class",[Sales Class])
    return
    SWITCH(TRUE(),
    Selection = "All Customers",SUMX(_table,[_2020_sales]),
    SUMX(FILTER(_table,[_sales_class] IN VALUES('Sales Class'[Selection])),[_2020_sales])
    )
    2021 Sales Measure = 
    VAR Selection = SELECTEDVALUE('Sales Class'[Selection])
    var _table = SUMMARIZE('Data','Data'[Customer],"_2021_sales",SUM('Data'[2021 Sales]),"_sales_class",[Sales Class])
    return
    SWITCH(TRUE(),
    Selection = "All Customers",SUMX(_table,[_2021_sales]),
    SUMX(FILTER(_table,[_sales_class] IN VALUES('Sales Class'[Selection])),[_2021_sales])
    )

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

4 Replies

  • ShaelynFrench , You need to use dynamic segmentation

     

    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

     

    Dynamic segmentation -Measure to Dimension conversion: https://youtu.be/gzY40NWJpWQ

     

    Customer Retention with Dynamic Segmentation, New/Lost/Retain Customer Count: https://youtu.be/EyL7KMw877Q

     

  • amitchandak  Hi, yes I believe what you are suggesting works great for Matrix visuals, but I am not able to use it for other visuals. Here's a link to an example: Link 

    • v-jingzhang's avatar
      v-jingzhang
      Icon for Community Support rankCommunity Support

      Hi ShaelynFrench

       

      Please try these new measures in your Gauge visual. 

      2020 Sales Measure = 
      VAR Selection = SELECTEDVALUE('Sales Class'[Selection])
      var _table = SUMMARIZE('Data','Data'[Customer],"_2020_sales",SUM('Data'[2020 Sales]),"_sales_class",[Sales Class])
      return
      SWITCH(TRUE(),
      Selection = "All Customers",SUMX(_table,[_2020_sales]),
      SUMX(FILTER(_table,[_sales_class] IN VALUES('Sales Class'[Selection])),[_2020_sales])
      )
      2021 Sales Measure = 
      VAR Selection = SELECTEDVALUE('Sales Class'[Selection])
      var _table = SUMMARIZE('Data','Data'[Customer],"_2021_sales",SUM('Data'[2021 Sales]),"_sales_class",[Sales Class])
      return
      SWITCH(TRUE(),
      Selection = "All Customers",SUMX(_table,[_2021_sales]),
      SUMX(FILTER(_table,[_sales_class] IN VALUES('Sales Class'[Selection])),[_2021_sales])
      )

       

      Best Regards,
      Community Support Team _ Jing
      If this post helps, please Accept it as Solution to help other members find it.