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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
mike_viz_lord
Frequent Visitor

Apply Date Range Filter Based on Condition

I'm trying to add a date range filter to my report page based on Created Date. However, the Created Date filter should only apply to Record Type = "B" and return all records where Record Type = "A". So if I selected a Created Date range of 5/1/2023 - 5/3/2023 it would display Record ID's 1, 2, 4, and 5. Any help to implement this would be greatly appreciated!

 

Record IDCreated DateRecord Type
13/1/2023A
23/1/2023A
34/5/2023B
45/3/2023B
55/3/2023B
2 REPLIES 2
mike_viz_lord
Frequent Visitor

Thank you for the reply. Your solution makes sense but I'd like to display a table that contains all columns, not just a card with the measure. 

FreemanZ
Super User
Super User

hi @mike_viz_lord 

you may use this code for further calculations:

VAR _table =
UNION(
    CALCULATETABLE(
        VALUES(data[Record ID]),
        ALL(data[Created Date]),
        data[Record Type]="A"    ),
    CALCULATETABLE(
        VALUES(data[Record ID]),
        data[Record Type]="B"
    )
)

 

for example, tried to verify like:

Measure = 
VAR _table =
UNION(
    CALCULATETABLE(
        VALUES(data[Record ID]),
        ALL(data[Created Date]),
        data[Record Type]="A"    ),
    CALCULATETABLE(
        VALUES(data[Record ID]),
        data[Record Type]="B"
    )
)
RETURN
CONCATENATEX(_table, data[Record ID], ", ")

it worked like:

FreemanZ_0-1683121502786.png

FreemanZ_1-1683121603548.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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