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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jsteffe
Helper III
Helper III

Date period filter

Hello,

 

I manage animal movements in buildings.

I get this table MOVEMENT : ID_movement, entry_date (in the building), exit_date (of the building), number of animals, building_id

 

When I choose one date, I want to get empty buildings.  (it means building with no animal, with no current movement).

 

What is the solution ?

 

Thanks for your help

Jérôme

 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @jsteffe ,

According to your description, here's my solution.

Create a measure:

Measure =
IF (
    MAX ( 'Table'[start date] ) <= SELECTEDVALUE ( 'Date'[Date] )
        && COALESCE ( MAX ( 'Table'[end date] ), TODAY () )
            >= SELECTEDVALUE ( 'Date'[Date] ),
    1,
    0
)

Put the measure in the visual level filter and select "is 1".

vyanjiangmsft_0-1686735370481.png

After apply filter, get the correct result:

vyanjiangmsft_1-1686735486796.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

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

 

View solution in original post

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @jsteffe ,

According to your description, here's my solution.

Create a measure:

Measure =
IF (
    MAX ( 'Table'[start date] ) <= SELECTEDVALUE ( 'Date'[Date] )
        && COALESCE ( MAX ( 'Table'[end date] ), TODAY () )
            >= SELECTEDVALUE ( 'Date'[Date] ),
    1,
    0
)

Put the measure in the visual level filter and select "is 1".

vyanjiangmsft_0-1686735370481.png

After apply filter, get the correct result:

vyanjiangmsft_1-1686735486796.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

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

 

Jelena_L
Frequent Visitor

Hi, I didn´t get the question right, but it seams, that you would need to use IF here. 

 

id_movementBuilding_IDstart dateend datenumber of animals
1A01/01/202330/03/2023150
2A15/02/202325/05/2023120
3B01/01/202310/01/202310
4B02/02/202316/04/202315
5C01/04/2023 25

 

With this date, if I choose 20/04/2023, I get 2 buildings that are not empty : A and C.
How to get these 2 buildings ?

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.