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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
ShahidYumeen
Helper I
Helper I

Using a date picker i want to show the latest date when no date is selected

Hi all,

I am using a date picker from custom visuals in my dashboard. The only problem is that when no date is selected in the picker then dashboard shows the data for all days which in our case is incorrect. How could i handle it. I dont want to handle the fields manually as there are so many fields used in the dashboard. How could i handle it with a date field only. any help ? 🙂

Thanks.

1 ACCEPTED SOLUTION
Kedar_Pande
Super User
Super User

@ShahidYumeen 

Create a measure to check if a date is selected:

DateFilterCheck =
IF(
ISFILTERED('DateTable'[Date]) && NOT(ISBLANK(MIN('DateTable'[Date]))),
1,
BLANK()
)

Add the DateFilterCheck measure to your visuals:
Use it as a filter by applying a condition: DateFilterCheck = 1.
This ensures that when no date is selected, all visuals using this measure will display no data.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

View solution in original post

6 REPLIES 6
shafiz_p
Super User
Super User

Hi @ShahidYumeen As I can understand, that you want if no selection then show data with the latest date other wise according to selection.

Create a measure to capture, if selection made or not. If, then capture that date other wise latest date. Try this (I am using year):

LatestOrSelectedYearRevenue =

VAR _LatestOrSelected=
IF(
    NOT ISFILTERED('Calendar'[Year]),
    MAX('Calendar'[Year]),
    SELECTEDVALUE('Calendar'[Year])
)

RETURN
CALCULATE(
    [Revenue],
    'Calendar'[Year] = _LatestOrSelected
)

 

Use this measure in your visuals. If year selected in slicer, then the year will be use to evaluate revenue otherwise latest in your calendar.

Change column name according to your need.  

 


Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

Thanks for the response. i actually dont want to calculate a single measure like you have done for revenue because i am already using a lot of different measures in my dashboard. Can i do it some other way without actually using any measure fields form my data and by only date field?

Bibiano_Geraldo
Super User
Super User

HI @ShahidYumeen ,
Create a Measure to Check Date Selection by this DAX:

 

DateSelected = 
IF(
    ISFILTERED('DateTable'[Date]),
    1,
    0
)

 

 

In your visual, go to the Filters pane, add the DateSelected measure, and set the filter condition to 1.

Thanks but i am not being able to add these measures in the filter pane.

Kedar_Pande
Super User
Super User

@ShahidYumeen 

Create a measure to check if a date is selected:

DateFilterCheck =
IF(
ISFILTERED('DateTable'[Date]) && NOT(ISBLANK(MIN('DateTable'[Date]))),
1,
BLANK()
)

Add the DateFilterCheck measure to your visuals:
Use it as a filter by applying a condition: DateFilterCheck = 1.
This ensures that when no date is selected, all visuals using this measure will display no data.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Hi Kedar,
Thanks for the response. This actually works for all the visuals except for the cards. I am not sure if filtering works differently with the card visuals but i couldnt put these filter on cards.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors