Close Menu
SkytikSkytik

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    At Least 32 People Dead After a Mine Bridge Collapsed Due to Overcrowding

    November 17, 2025

    Here’s how I turned a Raspberry Pi into an in-car media server

    November 17, 2025

    Beloved SF cat’s death fuels Waymo criticism

    November 17, 2025
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    SkytikSkytik
    • Home
    • AI Tools
    • Online Tools
    • Tech News
    • Guides
    • Reviews
    • SEO & Marketing
    • Social Media Tools
    SkytikSkytik
    Home»AI Tools»How to Filter for Dates, Including or Excluding Future Dates, in Semantic Models
    AI Tools

    How to Filter for Dates, Including or Excluding Future Dates, in Semantic Models

    AwaisBy AwaisJanuary 4, 2026No Comments5 Mins Read0 Views
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    How to Filter for Dates, Including or Excluding Future Dates, in Semantic Models
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Imagine that we have three measures:

    1. Sales Amount
    2. Sales Amount Budget
    3. Sales Amount PY

    When we look at a table with these numbers, we see this (assuming that we have current data until the end of July 2025):

    Figure 1 – Starting point. Notice that the Budget and the PY data go beyond the current data, which exists only until the end of July 2025 (Figure by the Author)

    While the results are correct, my users might need two different views:

    1. See only the results according to the existing data
    2. Including the Budget data and the PY data

    I have multiple ways to do it:

    1. Create separate Visuals with different filters.
    2. Create two pages for the two views, again by using different filters.
    3. Tell my users to use the Calendar slicer to filter the data as needed.

    But I want to design my reports as user-friendly as possible without duplicating anything.

    Therefore, I want to add a Slicer so users can choose whether to include future data or only see current data.

    Create the Date Filter table

    My Date table includes Index columns for different periods: Days, Weeks, Months, Quarters, and Years.

    • The row with the current period contains a 0
    • Rows for past periods contain negative numbers
    • Rows for futures periods contain positive numbers

    Let’s see the rows for a small sample realized in SQL by using the DayIndex column:

    Figure 2 – Sample rows from the Date table (Figure by the Author)

    Using this column, I constructed a table with an additional column to serve as a Slicer.

    I took all rows with an Index up to 0 and marked them as “Current Data only”.

    Then I appended (UNION) all rows from the Date table and marked them as “Future Data included”.

    Figure 3 – Complete selection for the Date Filter table (Figure by the Author)

    I did it with SQL, but you can do it in Power Query or any other language of your choice.

    Now, I imported this table into Power BI

    Expand the data model

    After adding this table to Power BI, I created a new Relationship between the new table and the Date table:

    Figure 4 – Creation of the Relationship between the new Date Filter and the Date table (Figure by the Author)

    The Cross-filter Direction must be set to Both as the column DateKey in the Date Filter table is not unique:

    Figure 5 – Relationship with the  Cross-filter direction set to both (Figure by the Author)

    Therefore, the filter direction would be Date -> Date Filter only, which will not work.

    I want to filter the Date table by the Date Filter table. Therefore, I must set the filter direction to “Both”.

    Result

    Next, I added a Slicer to the report:

    Figure 6 – The new Slicer set a Tile for the DateFilter column (Figure by the Author)

    After all the preparation, the Slicer allows the selection of the data as needed:

    Figure 7 – No future numbers are shown when “Current Data only” is selected (Figure by the Author)
    Figure 8 – All data is shown when “Future Data included” is selected (Figure by the Author)

    The users can use this slicer to choose which data they want to see, regardless of the selection in the Calendar slicer.

    Selecting full periods

    The example above is practical when the selection must be at the day level.

    This is useful especially when comparing the current data with the Budget or PY.

    Imagine on the 5th or 6th day of the month. You have only a few days of Sales, but you compare it to the Budget of the whole month. This can be misleading.

    But what happens when the filter must be set to full periods, like months or years?

    Here, a modified query to set the DateFilter column based on whole years:

    Figure 9 – Query to set the whole year for the DateFilter column (Figure by the Author)

    Now the entire year is shown, when only the current data should be shown:

    Figure 10 – The whole year is shown when using the modified query from above (Figure by the Author)

    You can change the Date Filter table in the same way to filter by months or other periods.

    This can be done very easily by filtering the rows in the Date table for the current date.

    Conclusion

    This approach is straightforward to implement and easy for Report consumers to use.

    It avoids writing DAX code and relies entirely on information in the Date table.

    The trick is to extend the data model to support the requirements with the least effort.

    If you don’t have the Index columns as I do, you can use a different approach to generate the Date Filter table. For example, use a function to get the current date, like GETDATE() in T-SQL or Now() in other languages.

    I found the Index columns very useful, not only in this case but also in many other situations where the client requires me to filter the data by dates relative to the current date.

    This makes life easy when the “current date” is not today, but must follow a specific logic—for example, the previous weekday.

    OK, you can add relative Filters to the report. In many cases, they are enough.

    In other cases, the Index columns give me more flexibility.

    References

    Like in my previous articles, I use the Contoso sample dataset. You can download the ContosoRetailDW Dataset for free from Microsoft here.

    The Contoso Data can be used freely under the MIT License, as described in this document. I changed the dataset to shift the data to contemporary dates.

    Dates Excluding filter future including Models Semantic
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Awais
    • Website

    Related Posts

    How a Neural Network Learned Its Own Fraud Rules: A Neuro-Symbolic AI Experiment

    March 18, 2026

    Bridging Modality Gap with Temporal Evolution Semantic Space

    March 18, 2026

    How to Effectively Review Claude Code Output

    March 18, 2026

    Everything You Need to Know About Recursive Language Models

    March 17, 2026

    [2601.15871] Why Inference in Large Models Becomes Decomposable After Training

    March 17, 2026

    Self-Hosting Your First LLM | Towards Data Science

    March 17, 2026
    Leave A Reply Cancel Reply

    Top Posts

    At Least 32 People Dead After a Mine Bridge Collapsed Due to Overcrowding

    November 17, 20250 Views

    Here’s how I turned a Raspberry Pi into an in-car media server

    November 17, 20250 Views

    Beloved SF cat’s death fuels Waymo criticism

    November 17, 20250 Views
    Don't Miss

    How a Neural Network Learned Its Own Fraud Rules: A Neuro-Symbolic AI Experiment

    March 18, 2026

    systems inject rules written by humans. But what if a neural network could discover those…

    Google says AI Mode stays ad-free for Personal Intelligence users

    March 18, 2026

    Search Referral Traffic Down 60% For Small Publishers, Data Shows

    March 18, 2026

    Bridging Modality Gap with Temporal Evolution Semantic Space

    March 18, 2026
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews

    Google Removes ‘What People Suggest,’ Expands Health AI Tools

    March 17, 2026

    A Revelatory Technique for Better Deviled Eggs

    March 17, 2026
    Most Popular

    13 Trending Songs on TikTok in Nov 2025 (+ How to Use Them)

    November 18, 20257 Views

    How to watch the 2026 GRAMMY Awards online from anywhere

    February 1, 20263 Views

    Corporate Reputation Management Strategies | Sprout Social

    November 19, 20252 Views
    Our Picks

    At Least 32 People Dead After a Mine Bridge Collapsed Due to Overcrowding

    November 17, 2025

    Here’s how I turned a Raspberry Pi into an in-car media server

    November 17, 2025

    Beloved SF cat’s death fuels Waymo criticism

    November 17, 2025

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook X (Twitter) Instagram Pinterest YouTube Dribbble
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    • Disclaimer

    © 2025 skytik.cc. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.