Forum Discussion

tecumseh's avatar
tecumseh
Icon for Resolver III rankResolver III
1 year ago
Solved

Get Slicer Selected Items in Calculated Table

Hi,
Using PBID Aug 2024.

How to get a list of slicer selected items in a calculated table?
The same slicer exists in different pages in report.
How does Calculated Table know which slicer/page I am referring to?

Hierarchy Slicer : 'Date Table'[Year], 'Date Table'[QQYY]

Thanks,
-w

  • Thanks parry2k 

    Converted to Measure and returning the correct result : 2

    Thanks,
    w

    Count of selected items =
    Var T1 =
        CALCULATETABLE(
            VALUES('Calendar'[Quarter]),
            ALLSELECTED('Calendar'[Quarter])
        )

    RETURN
        COUNTROWS(T1)

6 Replies

  • tecumseh hi sorry, your requirement/question is not very clear, could you provide more details on what you are trying to achieve.

    • tecumseh's avatar
      tecumseh
      Icon for Resolver III rankResolver III

      Hi parry2k ,

      I have a date hierarchy slicer
      2024
      |-Q1'24
      |-Q2'24
      |-Q3'24
      |-Q4'24
      2023
      |-Q1'23
      |-Q2'23
      |-Q3'23
      |-Q4'23

      etc.... through 2016

      User may select any combination of values
      How can I capture what the user selected into a Calculated table (Testing) or Virtual Table (Production)

      How dows either table know the difference if the same slicer is in use on multiple pages in the report?
      1 Page the user selected 2024
      On another page the user selected 2023

      Thanks,
      -w

  • tecumseh it is as confusing as your original post, I have no idea what is the ask here.

  • UncleLewis's avatar
    UncleLewis
    Icon for Responsive Resident rankResponsive Resident

    Sorry parry2k ,

    Let me try again with a screenshot and a pbix.
    Here is a sample DAX Formula I tried in a calculated table
    It is returning 4 quarters instaed of the 2 selected in the slicer

    I've tried several variations of the formula. They all lead to incorrect results or error messages.

    PBIX is here

    Thanks,
    -w





  • UncleLewis's avatar
    UncleLewis
    Icon for Responsive Resident rankResponsive Resident

    Thanks parry2k 

    Converted to Measure and returning the correct result : 2

    Thanks,
    w

    Count of selected items =
    Var T1 =
        CALCULATETABLE(
            VALUES('Calendar'[Quarter]),
            ALLSELECTED('Calendar'[Quarter])
        )

    RETURN
        COUNTROWS(T1)