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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jhd
Helper I
Helper I

Measure filtering to overlapping time periods of 2 tables when I don't want it to!

I have 2 tables , one contains actual sales from past 2 years, the other contains forecasted sales for the next 10 years (including the current year).

 

I have created a measure called Forecast_Volume:

 

=if([IsForecastValid],
CALCULATE(
SUM(Forecast[MC_5Y_Forecast]),
FILTER(ALL(Forecast[FYName]),
CONTAINS(VALUES('Calendar'[FYName]),'Calendar'[FYName],Forecast[FYName])
),
FILTER(ALL(Forecast[GOLDEN_ID]),
CONTAINS(VALUES(Golden_IDs[GOLDEN_ID]),Golden_IDs[GOLDEN_ID],Forecast[GOLDEN_ID])
),
FILTER(ALL(Forecast[PLANT]),
CONTAINS(VALUES(MASTER_DATA[PLANT]),MASTER_DATA[PLANT],Forecast[PLANT])
)
),
BLANK()
)

 

(IsForecastValid tests the granularity of the calendar dimension in the pivot table, as the forecast is yearly and actual sales are daily.)

 

The table that contains the forecast data is called "Forecast".

MC_FY_Forecast = the volume forecast

FYName = the name of the Financial Year

Golden_ID = is the identifier of each product

PLANT = is the identifier of each factory

 

The date column in Master_Data table (which contains the actual sales) is connected to the date column in the Calendar table.

The FYName column in the Forecast is connected to a "joining table" which contians unique values of FYName, which in turn is connected to FYName in the calendar table. So, both Forecast and Master_Data tables are connected to the Calander either directly or indirectly.

 

My problem:

My measure is only showing data where the time periods in the forecast and Master_Data tables overlaps, ie. this year.

 

Any idea why this is happening? I do not have any slicers.

 

Many thanks, James

 

 

1 ACCEPTED SOLUTION

I changed:

CONTAINS(VALUES(MASTER_DATA[PLANT]),MASTER_DATA[PLANT],Forecast[PLANT])

to

CONTAINS(VALUES(PLANTS[PLANT]),PLANTS[PLANT],Forecast[PLANT])

 

It appears that even though the MASTER_DATA and PLANTS tables are connected via the PLANTS column, it DOES matter which one you use in the DAX formula.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@jhd,

Please share sample data of your tables following the guide in this thread. Also we need to what DAX you use to calculate IsForecastValid measure.

Regards,
Lydia

I changed:

CONTAINS(VALUES(MASTER_DATA[PLANT]),MASTER_DATA[PLANT],Forecast[PLANT])

to

CONTAINS(VALUES(PLANTS[PLANT]),PLANTS[PLANT],Forecast[PLANT])

 

It appears that even though the MASTER_DATA and PLANTS tables are connected via the PLANTS column, it DOES matter which one you use in the DAX formula.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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