Forum Discussion

mkane12's avatar
mkane12
Icon for Helper I rankHelper I
1 year ago
Solved

Use Measures as a Slicer

I have a map and would like to be able to add a slicer to filter to either Loss $ and Loss Volume. How do I do this? 

 

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi mkane12  ,
    Thanks for reaching out to the Microsoft fabric community forum.

    Measures

    New measure and create the following measures:

    Measure 1: Losses

    Losses = 
    CALCULATE(
        SUM(McLeodIQ_Operations[Projected Carrier Margin]),
        McLeodIQ_Operations[Win//Loss] = "1"
    )

    Measure 2: Loss Vol

    Loss Vol = 
    CALCULATE(
        SUM(McLeodIQ_Operations[Volume]),
        McLeodIQ_Operations[Win//Loss] = "1"
    )


    Create a Disconnected Table for Measure Selection

    New table and create:

    MeasureSelector = DATATABLE(
        "MeasureName", STRING,
        {
            {"Losses"},
            {"Loss Vol"}
        }
    )

    This table has no relationship with your main data table , it’s just for the slicer.


    Create a Dynamic Measure

    Create a new measure named Selected Measure :

    Selected Measure = 
    VAR Selected = SELECTEDVALUE(MeasureSelector[MeasureName])
    RETURN
        SWITCH(
            Selected,
            "Losses", [Losses],
            "Loss Vol", [Loss Vol],
            BLANK()
        )

    Build the Visuals

    1. Go to Insert > Map visual.

    2. Drag McLeodIQ_Operations[ State ] to Location.

    3. Drag SelectedMeasue to Size or Tooltips depending on how you want it visualized.

    4. Add a Slicer to the canvas.

    5. Use MeasureSelector[ MeasureName ] in the slicer.

    Test It

    Select "Losses" or "Loss Vol" in the slicer.

    The map visual will update accordingly, reflecting the selected measure per state.

    Please find the attached pbix for reference


    If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

    Best Regards,
    Sreeteja.
    Community Support Team 

     

9 Replies

  • Hi mkane12,

    You cant be able to add a measure in a Slicer. You will create a calculated column for you requirement then you can use this as a slicer.

     

    Thanks,
    If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

     

    • mkane12's avatar
      mkane12
      Icon for Helper I rankHelper I

      thanks. I am newer to Power Bi, how would i create this column? 

      • mkane12's avatar
        mkane12
        Icon for Helper I rankHelper I

        this is the measure i have:

        Losses = CALCULATE(SUM(McLeodIQ_Operations[Projected Carrier Margin]),FILTER(McLeodIQ_Operations,McLeodIQ_Operations[Win//Loss]="1"))
  • the 2 measures i have are 
    Losses = CALCULATE(SUM(McLeodIQ_Operations[Projected Carrier Margin]),FILTER(McLeodIQ_Operations,McLeodIQ_Operations[Win//Loss]="1"))
    and

    Loss Vol = CALCULATE([Sum of Vol],FILTER(McLeodIQ_Operations,McLeodIQ_Operations[Win//Loss]="1"))
    I want to use these to filter a map and use them as a slicer.
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi mkane12  ,
      Thanks for reaching out to the Microsoft fabric community forum.

      Measures

      New measure and create the following measures:

      Measure 1: Losses

      Losses = 
      CALCULATE(
          SUM(McLeodIQ_Operations[Projected Carrier Margin]),
          McLeodIQ_Operations[Win//Loss] = "1"
      )

      Measure 2: Loss Vol

      Loss Vol = 
      CALCULATE(
          SUM(McLeodIQ_Operations[Volume]),
          McLeodIQ_Operations[Win//Loss] = "1"
      )


      Create a Disconnected Table for Measure Selection

      New table and create:

      MeasureSelector = DATATABLE(
          "MeasureName", STRING,
          {
              {"Losses"},
              {"Loss Vol"}
          }
      )

      This table has no relationship with your main data table , it’s just for the slicer.


      Create a Dynamic Measure

      Create a new measure named Selected Measure :

      Selected Measure = 
      VAR Selected = SELECTEDVALUE(MeasureSelector[MeasureName])
      RETURN
          SWITCH(
              Selected,
              "Losses", [Losses],
              "Loss Vol", [Loss Vol],
              BLANK()
          )

      Build the Visuals

      1. Go to Insert > Map visual.

      2. Drag McLeodIQ_Operations[ State ] to Location.

      3. Drag SelectedMeasue to Size or Tooltips depending on how you want it visualized.

      4. Add a Slicer to the canvas.

      5. Use MeasureSelector[ MeasureName ] in the slicer.

      Test It

      Select "Losses" or "Loss Vol" in the slicer.

      The map visual will update accordingly, reflecting the selected measure per state.

      Please find the attached pbix for reference


      If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

      Best Regards,
      Sreeteja.
      Community Support Team 

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi mkane12 ,
        May I ask if you have resolved this issue? If so, please mark the helpful reply and Accept it as the solutionand give a 'Kudos'. This will be helpful for other community members who have similar problems to solve it faster.