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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ak2812
Frequent Visitor

Getting the values in Table visual comparing with multiple date column as per selected slicer value

I've below data model :- 

ak2812_0-1755092451852.png

CLNDR table is joined with fact on 3 different date columns of fact table
Enroll_date - Active relationship
Activa_date - InActive relationship
Cancl_date - InActive relationship
Now I've multiselect slicers coming from Clndr Table (Year_No , Month_No) and as per Year-Month selection data will be displayed on table visual on certain condition
(clndryear in @selected year OR Year(Activa_date) in @selected year  OR Year(Cancl_date) in @selected year )
AND 
(clndrmonth in @selected MONTH OR Month(Activa_date) in @selected year  OR Month(Cancl_date) in @selected year )
Sampling some expected output (if Year - 2025 & Month - 1&2 is selected in slicer)

Enroll DateActiva DateCancl Date
05/02/202501/29/2019 
06/20/202502/22/2015 

 Explanation :- (for both record) As Enroll date is falling in selected year and Activa date is falling in selected month 
Any help is appreciated !

3 REPLIES 3
ak2812
Frequent Visitor

Hi  @DataNinja777   Thanks for your response 
My model is on direct query and when i put this measure in Filter on visual option , it throws below error 

ak2812_0-1755096522284.png

Note:- My Fact table contains around 1.3M data ! 

Hi @ak2812 ,

Thanks for reaching out to the Microsoft fabric community forum.

@DataNinja777 , 

Thanks for your prompt response

@ak2812  Based on the screenshot you have shared, below are a few suggested workarounds. I have also added the learning documents along with previously resolved cases, which may help you understand the issue better and assist in resolving it.

Workaround Options:

  1. Pre-filter the data using slicers or page-level filters to reduce the row count before the visual runs.
  2. Convert the measure logic into a calculated column if possible and filter on that instead. Calculated columns are evaluated during model load, not at query time.
  3. Use an aggregated table that summarizes the data at a higher grain (e.g., monthly totals, category-level summaries) and point your visual to that.
  4. Optimize the measure to avoid full table scans consider using variables or limiting the context with FILTER () more selectively.

DirectQuery in Power BI - Power BI | Microsoft Learn

Troubleshoot DirectQuery models in Power BI Desktop - Power BI | Microsoft Learn

Optimization guide for Power BI - Power BI | Microsoft Learn

DirectQuery optimization scenarios with the Optimize ribbon in Power BI Desktop - Power BI | Microso...

Solved: Direct Query 1 million row limitation in Power BI ... - Microsoft Fabric Community

 

Thanks for being an active member of the community.

 

Best Regards,

Lakshmi.

DataNinja777
Super User
Super User

Hi @ak2812 ,

 

You can solve this by creating a DAX measure that you then use as a filter on your table visual. A standard relationship can't handle this logic because your condition involves an OR across three different date columns that are checked against the same slicer. The measure will manually perform this check for every row.

 

You'll need to create a new measure in your fact table using the following DAX code. Remember to substitute 'FactTable' with your table's actual name and ensure the year and month column names from your CLNDR table are correct.

ShowRow = 
VAR SelectedYears = VALUES('CLNDR'[Year_No]) -- Replace with your actual year column, e.g., clndr_yr_nbr
VAR SelectedMonths = VALUES('CLNDR'[Month_No]) -- Replace with your actual month column

-- Get the date values for the current row being evaluated in the visual
VAR CurrentEnrollDate = SELECTEDVALUE('FactTable'[Enroll_date])
VAR CurrentActivaDate = SELECTEDVALUE('FactTable'[Activa_date])
VAR CurrentCanclDate = SELECTEDVALUE('FactTable'[Cancl_date])

-- Check if any of the row's years match the selected years
VAR IsYearMatch = 
    (YEAR(CurrentEnrollDate) IN SelectedYears) || 
    (YEAR(CurrentActivaDate) IN SelectedYears) || 
    (YEAR(CurrentCanclDate) IN SelectedYears)

-- Check if any of the row's months match the selected months
VAR IsMonthMatch = 
    (MONTH(CurrentEnrollDate) IN SelectedMonths) || 
    (MONTH(CurrentActivaDate) IN SelectedMonths) || 
    (MONTH(CurrentCanclDate) IN SelectedMonths)

-- Return 1 only if BOTH the year AND month conditions are met, otherwise return BLANK
RETURN
    IF(
        IsYearMatch && IsMonthMatch, 
        1, 
        BLANK()
    )

Once you've created the ShowRow measure, do not add it as a column to your visual. Instead, select your table visual and drag the [ShowRow] measure into the Filters pane under the "Filters on this visual" section. In the filter card for the measure, set the condition to "is not blank" and apply the filter.

 

This method works by dynamically calculating the measure for every row in your visual. It checks if any of the row's three date columns contain a year that is present in your selected years slicer, and also checks if any of the dates contain a month present in your selected months slicer. The measure returns a 1 only if a row satisfies both the year and month conditions. By filtering the visual to show where the measure is not blank, you effectively display only the rows that meet your complex criteria.

 

Best regards,

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.

Top Solution Authors