Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • Sulfur lava exoplanet L 98-59 d defies classification
    • Hisense U7SG TV Review (2026): Better Design, Great Value
    • Google is in talks with Marvell Technology to develop a memory processing unit that works alongside TPUs, and a new TPU for running AI models (Qianer Liu/The Information)
    • Premier League Soccer: Stream Man City vs. Arsenal From Anywhere Live
    • Dreaming in Cubes | Towards Data Science
    • Onda tiny house flips layout to fit three bedrooms and two bathrooms
    • Best Meta Glasses (2026): Ray-Ban, Oakley, AR
    • At the Beijing half-marathon, several humanoid robots beat human winners by 10+ minutes; a robot made by Honor beat the human world record held by Jacob Kiplimo (Reuters)
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Sunday, April 19
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»How to Filter for Dates, Including or Excluding Future Dates, in Semantic Models
    Artificial Intelligence

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

    Editor Times FeaturedBy Editor Times FeaturedJanuary 4, 2026No Comments6 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    Think about that we’ve three measures:

    1. Gross sales Quantity
    2. Gross sales Quantity Price range
    3. Gross sales Quantity PY

    Once we have a look at a desk with these numbers, we see this (assuming that we’ve present knowledge till the tip of July 2025):

    Determine 1 – Start line. Discover that the Price range and the PY knowledge transcend the present knowledge, which exists solely till the tip of July 2025 (Determine by the Creator)

    Whereas the outcomes are right, my customers would possibly want two totally different views:

    1. See solely the outcomes based on the prevailing knowledge
    2. Together with the Price range knowledge and the PY knowledge

    I’ve a number of methods to do it:

    1. Create separate Visuals with totally different filters.
    2. Create two pages for the 2 views, once more through the use of totally different filters.
    3. Inform my customers to make use of the Calendar slicer to filter the information as wanted.

    However I wish to design my studies as user-friendly as doable with out duplicating something.

    Due to this fact, I wish to add a Slicer so customers can select whether or not to incorporate future knowledge or solely see present knowledge.

    Create the Date Filter desk

    My Date desk contains Index columns for various intervals: Days, Weeks, Months, Quarters, and Years.

    • The row with the present interval accommodates a 0
    • Rows for previous intervals include adverse numbers
    • Rows for futures intervals include constructive numbers

    Let’s see the rows for a small pattern realized in SQL through the use of the DayIndex column:

    Determine 2 – Pattern rows from the Date desk (Determine by the Creator)

    Utilizing this column, I constructed a desk with a further column to function a Slicer.

    I took all rows with an Index as much as 0 and marked them as “Present Knowledge solely”.

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

    Determine 3 – Full choice for the Date Filter desk (Determine by the Creator)

    I did it with SQL, however you are able to do it in Energy Question or some other language of your alternative.

    Now, I imported this desk into Energy BI

    Develop the information mannequin

    After including this desk to Energy BI, I created a brand new Relationship between the brand new desk and the Date desk:

    Determine 4 – Creation of the Relationship between the brand new Date Filter and the Date desk (Determine by the Creator)

    The Cross-filter Path should be set to Each because the column DateKey within the Date Filter desk isn’t distinctive:

    Determine 5 – Relationship with the  Cross-filter course set to each (Determine by the Creator)

    Due to this fact, the filter course can be Date -> Date Filter solely, which won’t work.

    I wish to filter the Date desk by the Date Filter desk. Due to this fact, I need to set the filter course to “Each”.

    End result

    Subsequent, I added a Slicer to the report:

    Determine 6 – The brand new Slicer set a Tile for the DateFilter column (Determine by the Creator)

    After all of the preparation, the Slicer permits the choice of the information as wanted:

    Determine 7 – No future numbers are proven when “Present Knowledge solely” is chosen (Determine by the Creator)
    Determine 8 – All knowledge is proven when “Future Knowledge included” is chosen (Determine by the Creator)

    The customers can use this slicer to decide on which knowledge they wish to see, whatever the choice within the Calendar slicer.

    Choosing full intervals

    The instance above is sensible when the choice should be on the day stage.

    That is helpful particularly when evaluating the present knowledge with the Price range or PY.

    Think about on the 5th or 6th day of the month. You’ve gotten only some days of Gross sales, however you evaluate it to the Price range of the entire month. This may be deceptive.

    However what occurs when the filter should be set to full intervals, like months or years?

    Right here, a modified question to set the DateFilter column based mostly on complete years:

    Determine 9 – Question to set the entire 12 months for the DateFilter column (Determine by the Creator)

    Now your complete 12 months is proven, when solely the present knowledge ought to be proven:

    Determine 10 – The entire 12 months is proven when utilizing the modified question from above (Determine by the Creator)

    You possibly can change the Date Filter desk in the identical approach to filter by months or different intervals.

    This may be accomplished very simply by filtering the rows within the Date desk for the present date.

    Conclusion

    This strategy is simple to implement and simple for Report customers to make use of.

    It avoids writing DAX code and depends fully on info within the Date desk.

    The trick is to increase the information mannequin to assist the necessities with the least effort.

    In the event you don’t have the Index columns as I do, you should use a distinct strategy to generate the Date Filter desk. For instance, use a operate to get the present date, like GETDATE() in T-SQL or Now() in different languages.

    I discovered the Index columns very helpful, not solely on this case but in addition in lots of different conditions the place the shopper requires me to filter the information by dates relative to the present date.

    This makes life simple when the “present date” isn’t as we speak, however should observe a selected logic—for instance, the earlier weekday.

    OK, you may add relative Filters to the report. In lots of circumstances, they’re sufficient.

    In different circumstances, the Index columns give me extra flexibility.

    References

    Like in my earlier articles, I exploit the Contoso pattern dataset. You possibly can obtain the ContosoRetailDW Dataset totally free from Microsoft here.

    The Contoso Knowledge can be utilized freely below the MIT License, as described in this document. I modified the dataset to shift the information to up to date dates.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    Dreaming in Cubes | Towards Data Science

    April 19, 2026

    AI Agents Need Their Own Desk, and Git Worktrees Give Them One

    April 18, 2026

    Your RAG System Retrieves the Right Data — But Still Produces Wrong Answers. Here’s Why (and How to Fix It).

    April 18, 2026

    Europe Warns of a Next-Gen Cyber Threat

    April 18, 2026

    How to Learn Python for Data Science Fast in 2026 (Without Wasting Time)

    April 18, 2026

    A Practical Guide to Memory for Autonomous LLM Agents

    April 17, 2026

    Comments are closed.

    Editors Picks

    Sulfur lava exoplanet L 98-59 d defies classification

    April 19, 2026

    Hisense U7SG TV Review (2026): Better Design, Great Value

    April 19, 2026

    Google is in talks with Marvell Technology to develop a memory processing unit that works alongside TPUs, and a new TPU for running AI models (Qianer Liu/The Information)

    April 19, 2026

    Premier League Soccer: Stream Man City vs. Arsenal From Anywhere Live

    April 19, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    NSW gives the nod to a $3 billion CDC data centre in Western Sydney

    December 5, 2025

    The EPA Wants to Roll Back Emissions Controls on Power Plants

    June 11, 2025

    Startup Insurance 101: Protecting Your Venture

    November 19, 2024
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

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