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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
conjaean
Regular Visitor

Calculated table ignoring applied filters

Hi all,

 

I'm facing an issue with the creation of a calculated table. I have two tables: a DimDate table and a table "DimWerknemer" containing employees including the dates they started and left the company.

The goal is to create a calculated table showing all employees that were active in the selected period of the DimDate table.

The DAX code below is giving a table containing all employees, it seems to be ignoring the applied filters on DimDate[Dag].

 

ActiveUsers = 

VAR MinDate =
CALCULATE(MIN('DimDate'[Dag]),KEEPFILTERS(DimDate))

VAR MaxDate =
CALCULATE(MAX('DimDate'[Dag]),KEEPFILTERS(DimDate))

RETURN
CALCULATETABLE('DimWerknemer','DimWerknemer'[InDienstVanaf]<=MaxDate,'DimWerknemer'[InDienstTot]>=MinDate)

 Any help would be appreciated.

3 REPLIES 3
NanDeb
Helper I
Helper I

I have a similar concept table in one of my reports. 

NanDeb_0-1670413608307.png

 

NanDeb
Helper I
Helper I

AMMENDED as I meant FILTER NOT SUMMARIZE  

 

ActiveUsers = 

VAR MinDate = 
CALCULATE(MIN('DimDate'[Dag]),KEEPFILTERS(DimDate))

VAR MaxDate = 
CALCULATE(MAX('DimDate'[Dag]),KEEPFILTERS(DimDate))
 
RETURN
FILTER('DimWerknemer','DimWerknemer'[InDienstVanaf]<=MaxDate,'DimWerknemer'[InDienstTot]>=MinDate)

 

lukiz84
Memorable Member
Memorable Member

Hi,

 

calculated tables are calculated during refresh. There is no filter context during refresh, so your MinDate and MaxDate will always give the min and max date of the whole date table.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors