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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
vishu263
Helper II
Helper II

How to incorporate the page level filters into a DAX Measure

Hello,

 

I want to calculate the number of days on the basis of the Dates provided in the page filter using a DAX measure. For e.g if the 'Start Date' is on or after 1-Nov-2020 & 'End Date' is on or before 17-Dec-2020, we should get the output as 47 i.e. no.of days between start & end date. Please find the below snapshot for better understanding.

Capture_1.PNG

 

I tried using below measure but its not working.

NoOfDaysBetween=DATEDIFF(SELECTEDVALUE('TimeZone'[Begin]),SELECTEDVALUE('TimeZone'[End])

Thanks!

5 REPLIES 5
eliasayyy
Super User
Super User

maybe try 
NoOfDaysBetween=DATEDIFF(MAX('TimeZone'[Begin]),MAX('TimeZone'[End]),DAY)

Thanks for your response @eliasayyy . The above DAX doesn't give the desired output.

do you mind sharing sample dataset and the resuts

 

Sure, PFB

Capture_1.PNG

ok it seems you are using the same table in the filter thsi wont work in the filter panel due to when you first filter the begining date to the date , you will only have rows in the start of the date if the end date isnt in the rows it will return 0. can i se ethe table ? 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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