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
Suryateza
Frequent Visitor

Date range issue in slicer

Hi, 

Below is a measure for bookings between the created date column and the cancelled date column. I need to show the records that fall in the date range which i selected the slicer if any record  (created or cancel date) records that falls in the date range should show based on the slicer dates, as the below measure I'm getting all the created dates before the date range i selected 

Ex-6/19/2023 & 7/30/2023 are not in my range either (created date or cancel date) but the records are still showing. Can anyone please help me to eliminate these records by modifying the query?

 

Suryateza_1-1691505490096.png

 

 
Bookings = VAR __mindate = MIN('Calendar'[Date])                                                                                               
VAR __maxdate = MAX('Calendar'[Date])
VAR __curdate = MAX('report vwRevenueDashboardReport_BookingCard'[Createddate])
VAR __created =
SWITCH(
    TRUE(),
    __curdate < __mindate,
    0,
    ISBLANK(MAX('report vwRevenueDashboardReport_BookingCard'[Canceldate])),
    0,1
)
VAR __cancelled =
SWITCH(
    TRUE(),
    MAX('report vwRevenueDashboardReport_BookingCard'[Canceldate]) >= __mindate
        && MAX('report vwRevenueDashboardReport_BookingCard'[Canceldate]) <= __maxdate,
    -1,
    ISBLANK(MAX('report vwRevenueDashboardReport_BookingCard'[Canceldate]))
    ,1
)
VAR __result = __created + __cancelled
RETURN
__result
 
 
 
5 REPLIES 5
parry2k
Super User
Super User

@Suryateza you need to review this logic, it is returning the value of 1 when the cancel date is blank ()

 

    ISBLANK(MAX('Table'[Canceldate]))
    ,1


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Suryateza Is it possible to share pbix file, and explain which rows shouldn't be showing? Make sure to remove sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k  sent to your email, Please check

parry2k
Super User
Super User

@Suryateza wherever you have 0 in your measure change it to BLANK ()

 

👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k , Thanks for responing, Still the same result, Thank you

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.