Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Trouble Filtering using a slicer that's not connected to the data model

HI, I have a report that contains a directquery data model and I have no permissions to change it.
I had to create a few local tables and use them in the report. One of them i use as a slicer for the user to choose one or more of the options.

I created a slicer with a local table not connected to the dataset. 
I want to take the choice the user makes and filter the data that is part of the data model
StevenT_0-1649861500704.png

in the table to be filtered, I created a measure that brings in data from another table that's not connected in the relationship, using the TREATAS function. It's a measure.

Since the rule is that you can't put a measure in a slicer, I did the following

1) Created that local table with the three options you see above

2) User chooses the option(s)

My goal is to filter , but I can't seem to write the code that makes this happen. I see examples of calculating numerical data but can't find examples of a slicer option filtering text against the same text in a table

Any help appreciated. Thank you!

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

Create a measure using this pattern:

 

Row Count =
CALCULATE (
    COUNTROWS ( DIM_DATE ),
    SELECTEDVALUE ( SlicerTable[Month] ) = DIM_DATE[MONTH_DESC]
)

 

Assumptions:

1. DIM_DATE is a DirectQuery table.

2. SlicerTable is a disconnected table.

3. The slicer uses SlicerTable[Month].





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

I just want to confirm if you resolved this issue? If yes, you can accept the answer helpful as the solution or share you method and accept it as solution, thanks for your contribution to improve Power BI.

If you need more help, please let me know.

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

DataInsights
Super User
Super User

@Anonymous,

 

Create a measure using this pattern:

 

Row Count =
CALCULATE (
    COUNTROWS ( DIM_DATE ),
    SELECTEDVALUE ( SlicerTable[Month] ) = DIM_DATE[MONTH_DESC]
)

 

Assumptions:

1. DIM_DATE is a DirectQuery table.

2. SlicerTable is a disconnected table.

3. The slicer uses SlicerTable[Month].





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.