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
jamiefisher
Helper I
Helper I

Using a date parameter / filter in a visual

I have a table of absences e.g

 

NameStart DateEnd Date
John01/08/2330/08/23
John10/03/2311/03/23
Mark02/08/2304/08/23

 

I want users to be able to select a date e.g. 03/08/23 and to return John and Mark as being absent on this date

 

How best would I do this?

1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

If you are going to use a single value for your date selection you could use something like this:

 

Measure =
    IF (
        SELECTEDVALUE('date'[Date]) >= CALCULATE(MAX('Table'[Start Date]))&&
        SELECTEDVALUE('date'[Date]) <= CALCULATE(MAX('Table'[End Date])),
        "Yes",
        "No"
    )
 
you'll need a separate date table, i've included a PBIX file to review
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

7 REPLIES 7
jamiefisher
Helper I
Helper I

Thank you for this - applied it easily to my visuals and works beautifully 👍

Hi I have hit another issue, the measure works fine and displays a "yes" where absences cover the selected dates. I now want to do some counts and calculations but cannot do these on a measure, how do i do this?

Hi,

 

You should still be able to do calculations on a measure, do you have an example of a calculation you are working on with some sample data and i'll have a look at it

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Hi from what you sent me yesterday I need to understand how I go about being able to count or sum from the results of a measure or do I need a new measure whith slightly more complex code?

 

jamiefisher_0-1700671738961.png

 

Ah okay, you should be able to use sumx to create a sum and just adjust the measure slightly, try the code below:

 

SumMeasure =
CALCULATE(
    SUMX(
        'Table (2)',
        IF (
            SELECTEDVALUE('date'[Date]) >= 'Table (2)'[Start Date] &&
            SELECTEDVALUE('date'[Date]) <= 'Table (2)'[End Date],
            1,
            0
        )
    )
)
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Perefct - thank you for your prompt help with this! 😊

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

If you are going to use a single value for your date selection you could use something like this:

 

Measure =
    IF (
        SELECTEDVALUE('date'[Date]) >= CALCULATE(MAX('Table'[Start Date]))&&
        SELECTEDVALUE('date'[Date]) <= CALCULATE(MAX('Table'[End Date])),
        "Yes",
        "No"
    )
 
you'll need a separate date table, i've included a PBIX file to review
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.