Forum Discussion

garythomannCoGC's avatar
garythomannCoGC
Icon for Impactful Individual rankImpactful Individual
1 year ago
Solved

two card visuals on a report tab. multi-value slicer driven.

two card visuals on a report tab. using slicer to choose two values from a table. how to display the two values independently on each of the two sets of card visuals?  each card visual displays a col...
  • grazitti_sapna's avatar
    1 year ago

    Hi garythomannCoGC , 
    We can solve this problem by using DAX measures and logic to display two independently selected values from a slicer on separate card visuals in Power BI. we can try the steps below:

    • Breaking Down the Problem
      • You have a slicer connected to a table with a column of values (SPO_ID in this case).
      • Users can select up to two values from the slicer.
      • Two card visuals are present:
      • Card 1: Displays the first selected value.
      • Card 2: Displays the second selected value.
      • If more than two values are selected, the visuals should default to displaying the minimum and maximum values of the selected SPO_ID
    • DAX
      we will Create two separate measures for the two card visuals:
      • Measure 1: First Selected Value
        First Selected Value =
        IF(
        COUNTROWS(VALUES(Table[SPO_ID])) <= 2,
        MIN(VALUES(Table[SPO_ID])),
        MINX(ALLSELECTED(Table), Table[SPO_ID])
        )
      • Measure 2: Second Selected Value
        Second Selected Value =
        IF(
        COUNTROWS(VALUES(Table[SPO_ID])) = 2,
        MAX(VALUES(Table[SPO_ID])),
        MAXX(ALLSELECTED(Table), Table[SPO_ID])
        )
    • Explanation of the DAX
      • VALUES(Table[SPO_ID]): Returns the list of currently selected values in the slicer.
      • COUNTROWS(VALUES(Table[SPO_ID])): Checks how many values are selected.
      • If 1 or 2 values are selected, it proceeds to display the MIN or MAX.
      • If more than 2 values are selected, it defaults to the global MINX or MAXX.
      • ALLSELECTED(Table): Ensures the measure respects the slicer selection for context.
    • Set Up Card Visuals
      • Add Card 1:
        Set the data field to First Selected Value.
      • Add Card 2:
        Set the data field to Second Selected Value.

    I hope this Works

    If I have resolved your question, please consider marking my post as a solution. Thank you!