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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Help with Date Filter and Status

I am trying to create a visual that shows the number of widgets open as of a certain date. The SQL we have used in the past to do this is: 

     AND rs.date_issued <= :RDate
       AND (   rm.status IN ('O', 'R')
            OR (rm.status = 'C' AND RM.ACT_DATE_CLOSED > :RDate))
 
I have tried two date filters and a status filter, but it has not worked. Any assistance would be helpful.
 
Thanks!
1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

Try this:

IsAfterSelectDate =
VAR SelectDate =
    SELECTEDVALUE ( 'Calendar'[Date] )
VAR CurrentClosedDate =
    MAX ( 'Table'[Date Closed] )
VAR CurrentIssuedDate =
    MAX ( 'Table'[Issued Date] )
RETURN
    IF (
        ISBLANK ( CurrentClosedDate )
            && SelectDate >= CurrentIssuedDate,
        1,
        IF ( CurrentClosedDate > SelectDate && SelectDate >= CurrentIssuedDate, 1, 0 )
    )

datefilter.PNG

 

Best Regards,

Icey

 

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

9 REPLIES 9
Greg_Deckler
Community Champion
Community Champion

I believe you want the Open Tickets quick measure:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks Greg! This is real close but the user needs to be able to select specifc dates in the visual. Any ideas?

Icey
Community Support
Community Support

Hi @Anonymous ,

Please give me some data sample.

 

Best Regards,

Icey

Anonymous
Not applicable

Hi there, Here is a small data example. Bascially, users want to be able to select a specific data filter and get a count of reports open at that specific date.  In the example below, we would expect a count of three open on 10. 1.2019.

 

Forum Example.png

 
Icey
Community Support
Community Support

Hi @Anonymous ,

Try this:

1. Create a calendar table. It is independent of the other table.

Calendar = CALENDARAUTO()

2.  Create measures.

IsAfterSelectDate =
VAR SelectDate =
    SELECTEDVALUE ( 'Calendar'[Date] )
VAR CurrentDate =
    MAX ( 'Table'[Date Closed] )
RETURN
    IF ( ISBLANK ( CurrentDate ), 1, IF ( CurrentDate > SelectDate, 1, 0 ) )
Count of Open = SUMX('Table',[IsAfterSelectDate])

 count of open.PNGcount of open 2.PNG

PBIX file attached.

 

Best Regards,

Icey

 

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

Anonymous
Not applicable

Thanks Icey. This almost works, but we also need to consider the issued date. For example, if someone selects an earlier date, the number should also change.   See below. This count should be 0 since none of the report were issued in January 1, 2017.

 

Forum Example 2.png

 

Icey
Community Support
Community Support

Hi @Anonymous ,

Try this:

IsAfterSelectDate =
VAR SelectDate =
    SELECTEDVALUE ( 'Calendar'[Date] )
VAR CurrentClosedDate =
    MAX ( 'Table'[Date Closed] )
VAR CurrentIssuedDate =
    MAX ( 'Table'[Issued Date] )
RETURN
    IF (
        ISBLANK ( CurrentClosedDate )
            && SelectDate >= CurrentIssuedDate,
        1,
        IF ( CurrentClosedDate > SelectDate && SelectDate >= CurrentIssuedDate, 1, 0 )
    )

datefilter.PNG

 

Best Regards,

Icey

 

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

Anonymous
Not applicable

Thanks @Icey.  I got the number I was looking for, but when I created a relationship between the new CALENDAR table and my data table, it did not work. I need to be able to have a table of data results that users can export for reporting. Should the reltionship be on the ISSUED DATE or the CLOSED DATE?

Icey
Community Support
Community Support

Hi @Anonymous ,

The new table "Calendar" which is a slicer table need to be independent of other tables. If it is not independent of other tables, it will be affected by them when selected. The effect is called interaction.

 

Best Regards,

Icey

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors