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
Anonymous
Not applicable

Calculate days in period ignoring table filters

Hi, 

 

I have a table which I created in Power BI but a measure is not giving me the value I'm expecting. 

 

I need the measure to essentially do 'Minutes in Period' (from slicer in this scenario is 01/01/2019 - 22/01/2019). So there are 1440 minutes in a day. Times that by 22 days = 31,680 minutes in the period. The field I've put it in is 'DateTimeSLA'. 

 

My current measure is doing the following;

 

DateTimeInPeriod =
VAR FirstDay = CALCULATE(MIN('Service Downtime'[Date time reported]),ALLSELECTED('Service Downtime'[Date time reported]))
VAR LastDay = CALCULATE(MAX('Service Downtime'[Date time reported]),ALLSELECTED('Service Downtime'[Date time reported]))
RETURN
CALCULATE(DISTINCTCOUNT('Service Downtime'[Date time reported]),
DATESBETWEEN('Service Downtime'[Date time reported],FirstDay,LastDay))
 
All I need is the number of minutes between both dates in my slicer, ignoring the table filters/values.
 
Sample table below;

 

image.png

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can create measure like DAX below.

 

Total Minute =
VAR FirstDay = CALCULATE(MIN('Service Downtime'[Date time reported]),ALLSELECTED('Service Downtime'[Date time reported]))
VAR LastDay = CALCULATE(MAX('Service Downtime'[Date time reported]),ALLSELECTED('Service Downtime'[Date time reported]))
RETURN
DATEDIFF(FirstDay , LastDay, MINUTE) 

Best Regards,

Amy

 

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

 

View solution in original post

1 REPLY 1
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can create measure like DAX below.

 

Total Minute =
VAR FirstDay = CALCULATE(MIN('Service Downtime'[Date time reported]),ALLSELECTED('Service Downtime'[Date time reported]))
VAR LastDay = CALCULATE(MAX('Service Downtime'[Date time reported]),ALLSELECTED('Service Downtime'[Date time reported]))
RETURN
DATEDIFF(FirstDay , LastDay, MINUTE) 

Best Regards,

Amy

 

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

 

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.