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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Ian_Stuart_Rupe
Advocate III
Advocate III

Creating a table in DAX using a fliter

I am sure there is a way to do this but I am pulling my hair out!

 

As a DAX table expression this works (returns expected number of rows):

Filtered Fact = FILTER(Fact_Event,Fact_Event[Dim_Student_Key] = 12071)

 
Whereas this doesn't (does not filter rows at all):
Filtered Fact = FILTER(Fact_Event,Fact_Event[Dim_Student_Key] = [Selected Student Key])
 
[Selected Student Key] evaluates to 12071 and is an integer.
 
What am I doing wrong?
7 REPLIES 7
Ian_Stuart_Rupe
Advocate III
Advocate III

and [Selected Student Key] is a measure

@Ian_Stuart_Rupe what is the expression of [Selected Student Key] measure



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k  here you go: 

Selected Student Key = SELECTEDVALUE(Dim_Student[Dim_Student_Key])

@Ian_Stuart_Rupe so your fact doesn't have relationship with Dim_Student?? if yes then why you need to filter, once you filter dim student it will filter fact table?

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@Ian_Stuart_Rupe sorry read your post again, seems like you are trying to create a table with filtered student, unfortunately you cannot pass slicer value to when creating table using DAX and that is the reason your first expression works and 2nd one doesn't.

 

So question here is why you need a table?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks again @parry2k The user wants to be able to fliter Dim_Student from attributes that are in Dim_Course.  There is no direct relationship between these two tables but there is Fact_Event in between.  One to many relationships from dims to the fact and single filter direction.rELATIONSHIPSrELATIONSHIPS

 

The filters (which they want on the filter pane) should only show those Dim_Course rows for which there are associated Dim_Student events.  Make sense?

 

Creating this filtered fact table was my idea of a step along the journey to create a filtered Dim_Course table that I could use in the filter.

 

I suspect there is a better way!!

 

So if I was able to do this in SQL (which I can write :-)) it would look something like this:

 

SELECT
Course_Code,
Mode_Of_Study
FROM Dim_Course c
INNER JOIN Fact_Event e
ON c.Dim_Course_Key = e.Dim_Course_Key
WHERE e.Dim_Student_Key = @Selected_Student_Key

 

I suspect I need to use crossfiltering or something but I bascically need a dynamic table that I can use as the source for a filter.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.