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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
catnapwat
Helper I
Helper I

Secondary data table not filtering from slicer

I have a main fact table which has a dd mmmm yy Date format, and a full Date table (with hierarchy) which I use as my date filter.

 

I also have a secondary table which has an unusual date format that I've had to massage into the Period.Formatted column shown. I've added the Month and Year columns using Power Query.

There is a relationship between the two using the Brand column. PBI will only let me use Many-to-many as there are multiple rows per month in the secondary table due to the Confidence and Type columns. Using a slicer on Brand works to filter both tables so that's something.

 

In this example, the Value column is ignoring the slicer and showing the sum all available data. In this example, I have added a further slicer on the Month column from the secondary table, which then shows the correct value.

 

How can I get the secondary table to filter correctly based on my original slicer (top-right in screenshots, showing "between" for January)? I feel like it's a relationship issue but if I move the relationship to Date instead, my test measure (Theoretical Income) is showing incorrect figures.

 

Where am I going wrong?

1 ACCEPTED SOLUTION

Solved using TreatAs()

 

GI from Forecast = CALCULATE(
SUM('GI from Forecast 2020 sheet'[Value]),
TREATAS(
SUMMARIZE(DateTable,DateTable[Year],DateTable[MonthOfYear]),
'GI from Forecast 2020 sheet'[Year],
'GI from Forecast 2020 sheet'[MonthNumber]
)
)


Referencing this guide from SQLBI.


I still have the bridge table for the client name, but the Date bridge didn't work as it created too many filter paths for my setup. However, passing the filter context to the secondary table using Treatas worked... a treat.

Thanks for the assist guys.

View solution in original post

11 REPLIES 11

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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