cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills 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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors