Forum Discussion

albertowong's avatar
albertowong
New Member
1 year ago
Solved

Measures vs Custom Columns

Hi There.    I have a very unique problem and I was hoping you could help.    I have a project that requires me to filter the some data with very specific queries. This filters are very specific ...
  • v-kpoloju-msft's avatar
    1 year ago

    Hi albertowong,

    Thank you for posting your query in Microsoft Fabric Community Forum. Also, thanks to danextianAlexisOlson, for his inputs on this thread. Here I provided workaround that might be resolve the issue quickly.

    I completely understand the challenge you are facing. You are right that using slicers with measures directly is not possible, and manually recreating pages for each category can quickly become unmanageable.

    Based on what you are shared, a potential solution would be to use a "disconnected table" approach. Here's how it could work in theory:

    • Create a disconnected Category table (e.g., Category Name: "Category 1", "Category 2", etc.). This table won’t be related to your model.
    • Add a slicer based on that Category table so the user can choose a category easily.
    • In your measure logic, use the selected value from the disconnected Category table to dynamically apply the appropriate filters within a SWITCH statement. This way, when the user selects a category from the slicer, the corresponding logic is triggered, and all the complex filtering gets applied behind the scenes.

    This approach will give users a simple slicer interface to choose the category, while the measure dynamically handles the logic based on the selection no need for custom columns or maintaining multiple pages.

    Kindly refer to the below mentioned documents for better understanding:
    SWITCH function (DAX) - DAX | Microsoft Learn
    SELECTEDVALUE function - DAX | Microsoft Learn
    CALCULATE function (DAX) - DAX | Microsoft Learn

    Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

    Thank you for using the Microsoft Community Forum.