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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
strn1k
Frequent Visitor

Dax measure filtering in charts

Hi I have an issue with filtering my charts by DAX measure.

This is my measure: 

IsInDateRange =
VAR FromDate = MIN(DateTable[Date])
VAR ToDate = MAX(DateTable[Date])

RETURN
IF (
        SELECTEDVALUE(DataSource[JADate]) >= FromDate
        && SELECTEDVALUE(DataSource[JADate]) <= ToDate
        && SELECTEDVALUE(DataSource[DateSigned]) <= ToDate
        && SELECTEDVALUE(DataSource[CvOutDate]) <= ToDate
        && SELECTEDVALUE(DataSource[SendOutDate]) <= ToDate
        && SELECTEDVALUE(DataSource[ScoreDate]) <= ToDate
        && SELECTEDVALUE(DataSource[DateInterview]) <= ToDate
        && SELECTEDVALUE(DataSource[InterviewsScoreDate]) <= ToDate,
    1,
    0
)

I use its result as a filter (IsInDateRange is 1) in my table visualization and it works as it should. 
But when I put this measure as a filter into my graphs and pie chart it doesnt work.

For example when I select date range 1.1.2024 - 7.1.2024 there are 1199 rows (JobApplication Ids) in my table but in my stacked bar chart where I want to split JobApplications by "Collar" I can see the total counts without any restriction (filter) and thats also correct but when I apply the IsInDateRange measure into the filters on this visualization all the data is gone...

I tried many things to fix this but I am out of ideas.

Thank you in advance for any advice

Below I attached some screenshots which should be helpful to understand the problem.

strn1k_0-1718958474393.pngstrn1k_1-1718960600970.pngstrn1k_2-1718960786326.png

 

 




4 REPLIES 4
Anonymous
Not applicable

Hi @strn1k ,

May I ask if your problem has been solved. If the above reply was helpful, you may consider marking it as solution. If the problem is not yet solved, please feel free to ask us a question.

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

Hi, no the problem has not been solved. @lbendlin just gave me prettier code.

lbendlin
Super User
Super User

Consider simplifying your code.

 

IsInDateRange =
IF (
        SELECTEDVALUE(DataSource[JADate]) IN DateTable[Date]
        && MAX(SELECTEDVALUE(DataSource[JADate]),
               SELECTEDVALUE(DataSource[DateSigned]),
               SELECTEDVALUE(DataSource[CvOutDate]),
               SELECTEDVALUE(DataSource[SendOutDate]),
               SELECTEDVALUE(DataSource[ScoreDate]),
               SELECTEDVALUE(DataSource[DateInterview]),
               SELECTEDVALUE(DataSource[InterviewsScoreDate])) <= MAX(DateTable[Date]),
    1,
    0
)

 

Is your calendar table disconnected?

Thanks for the prettier code. 

Yes, the calendar table is not linked to the DataSource table as you can see in the screenshots I provided.

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.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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