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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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