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
Jack00711
Frequent Visitor

Custom table is not working when filtering on date

Hello Power BI Community,

 

I am having issue with a report, I am trying to create.

I have 2 tables Calendar and Tasks.
Below is the table Tasks :
Deliverable_IDTaskValueDate

1A0.830/12/2024
1B0.79/12/2024
1C0.69/12/2024
1D0.59/12/2024
2A0.89/12/2024
2B0.79/12/2024
2C0.61/12/2024
2D0.52/12/2024
1A0.53/12/2024
1B0.44/12/2024
1C0.35/12/2024
1D0.26/12/2024

 

I am creating a custom table using the below Formula :

FilteredTasks =
VAR SelectedDate = MAX('Calendar'[Date]
RETURN
    FILTER(
        ALL(Tasks),
        Tasks[Date] <= SelectedDate 
    )
 
I want to use the Calendar Date as a Filter. When I select Date 6/12/2024, It should show all the tasks which have Date less than 6/12/2024.
I have checcked data type in both tables. I have attached the PBIX file and excel used in the report.
I would really apprieciate if somebody can help.
Thank you
 



1 ACCEPTED SOLUTION
Sergii24
Super User
Super User

Hi @Jack00711, you don't need to build a calculated table for this case. Calculated table is refreshed once, when your semantic model is refreshed. Therefore, any further interaction with slicers won't change it.

 

If you already have a classic data model like this, the only thing you need to do is to apply a filter on "Date" column from "Calendar" table, it will filter the fact table accordingly.

Sergii24_0-1734000025388.png

 

Then you create DAX measure that will show you data for all fields selected before the current date, but when using data in slicer visual there is an easier way:

Sergii24_1-1734000171458.png

You can find sample pbix attached.

 

Good luck with your project 🙂

 

View solution in original post

8 REPLIES 8
grazitti_sapna
Super User
Super User

Hi @Jack00711 ,
If you want to dynamically filter the data based on the slicer, you should not use a calculated table like FilteredTasks, as it does not respond dynamically to slicers. Instead, you can achieve the desired behavior in one of the following ways:

Option 1: Add a Measure
You can create a measure to use directly in your visual:

FilteredTaskValue = 
VAR SelectedDate = MAX('Calendar'[Date])
RETURN
SUMX(
FILTER(
Tasks,
Tasks[Date] <= SelectedDate
),
Tasks[Value]
)

You can then add this measure to your table or matrix visual, and it will dynamically display the sum of Value for tasks with dates less than or equal to the selected date.

Option 2: Use a Visual-Level Filter
If you prefer using a calculated column or table, try applying a visual-level filter instead of relying on a calculated table. For example:

  1. Use the original Tasks table for your visual.
  2. Add a slicer with Calendar[Date].
  3. In the table or matrix visual, set a filter on Tasks[Date]:
    • Condition: Tasks[Date] <= SelectedDate.

Option 3: Modify the DAX for Calculated Table
If you insist on creating a calculated table, you can modify the DAX formula as follows:

FilteredTasks =
VAR SelectedDate = MAX('Calendar'[Date])
RETURN
FILTER(
Tasks,
Tasks[Date] <= SelectedDate
)

Then, use this table in your visuals. Note that the calculated table is static and does not respond to slicers unless you refresh the model.

I hope the provided solution works for you

If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.

Sergii24
Super User
Super User

Hi @Jack00711, you don't need to build a calculated table for this case. Calculated table is refreshed once, when your semantic model is refreshed. Therefore, any further interaction with slicers won't change it.

 

If you already have a classic data model like this, the only thing you need to do is to apply a filter on "Date" column from "Calendar" table, it will filter the fact table accordingly.

Sergii24_0-1734000025388.png

 

Then you create DAX measure that will show you data for all fields selected before the current date, but when using data in slicer visual there is an easier way:

Sergii24_1-1734000171458.png

You can find sample pbix attached.

 

Good luck with your project 🙂

 

danextian
Super User
Super User

Calculated tables are update only when:

-the formula is modifed

-the reference tables/columns update

-upon refresh

It isn't directly updated by slicer selections. Changes in the table view can affect the report view but it is no the other way around.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Bibiano_Geraldo
Super User
Super User

Hi @Jack00711 ,
Calculated tables (like the FilteredTasks table you're creating) are not directly affected by slicers in Power BI because calculated tables are evaluated during the data refresh and not dynamically like measures or visuals. This means slicers won't affect them in real-time.

Here’s how you can address the problem using a measure that will react to slicers:

FilteredTasksMeasure =
VAR SelectedDate = SELECTEDVALUE('Calendar'[Date])
RETURN
    CALCULATE(
        COUNTROWS(Tasks),
        FILTER(
            Tasks,
            Tasks[Date] <= SelectedDate
        )
    )



You can now use this measure in your visuals, and the results will be filtered by the selected date from the slicer in the Calendar table. It will dynamically show the number of tasks (or other aggregations) based on the selected date.

Thank you @danextian  @Bibiano_Geraldo @Sergii24 
What I am trying to achieve is this : 

For Selected Date 9/12/2024:

Deliverable_ID Task Value Date

1A80%9/12/2024
1B70%9/12/2024
1C60%9/12/2024
1D50%9/12/2024
2A80%9/12/2024
2B70%9/12/2024
2C60%1/12/2024
2D50%2/12/2024

For Selected Date 6/12/2024:

Deliverable_ID Task Value Date

2C60%1/12/2024
2D50%2/12/2024
1A50%3/12/2024
1B40%4/12/2024
1C30%5/12/2024
1D20%6/12/2024


I am using the following formula but it's not working properly. This formula I was trying to debug where the issue is, that's where that table I created.

 
Value per Task =
VAR SelectedDate = MAX('Date'[Date]) -- Get the selected date from the Date table
VAR FilteredTasks =
    FILTER(
        Tasks,
        Tasks[Date] <= SelectedDate -- Include only tasks with dates <= selected date
    )
VAR LatestDates =
    SUMMARIZE(
        FilteredTasks,
        Tasks[Deliverable_ID],
        Tasks[Task],
        "LatestDate", MAX(Tasks[Date]) -- Get the latest date for each Deliverable_ID and Task
    )
RETURN
    CALCULATE(
        MAX(Tasks[Value]),
        FILTER(
            Tasks,
            Tasks[Date] =
                MAXX(
                    FILTER(
                        LatestDates,
                        Tasks[Deliverable_ID] = EARLIER(Tasks[Deliverable_ID]) &&
                        Tasks[Task] = EARLIER(Tasks[Task])
                    ),
                    [LatestDate]
                )
        )
    )
 
I have attached the report and Data file, If you could point out the issue in the formula that would be great. Thank you
 Sample Data 
Report 

your google drive link requires a permission

danextian_0-1734001595534.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian Apologies about that, here are the updated links : 
 Sample Data 
Report 

Anonymous
Not applicable

Hi,

Thanks for the solutions grazitti_sapna , danextian  ,Sergii24 , and Bibiano_Geraldo  offered, and i want to offer some more informaiton for user to refer to.

hello @Jack00711 , if you want to display the date before the date you selected, you need to remove the relationship between the tables. then create a measure.

Measure = CALCULATE(SUM(Tasks[Value]),FILTER(Tasks,Tasks[Date]<=MAX('Calendar'[Date])))

Then create a table visual, put the measure and the data column of task table to the visual.

vxinruzhumsft_0-1734058278007.png

Put the date of calendar column to the slicer.

Output

vxinruzhumsft_1-1734058331715.png

 

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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