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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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