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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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