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
aak
Helper I
Helper I

Calculating the number of minutes between dates in slicer

Hi,

 

I have a question I am hoping someone can answer. Basically I have a table that has a date for each record. There are not records for each date. For instance, there may be a record on 3/1/2021 and 4/13/2021, but those are the only ones. I have a slicer that utilizes this date as the filter. The problem comes that I am trying to analyze some numbers, but I need to calculate the number of minutes in the date slicer. For instance, if the date range selected is 4/1/2021 - 4/30/2021, I need the number of minutes between those two dates. Is there any way to do this?

4 REPLIES 4
Anonymous
Not applicable

[Num of Mins] =
var MinDate = MIN( Slicer[Date] )
var MaxDate = MAX( Slicer[Date] )
var MinCount =
    ( MaxDate - MinDate ) // num of days
        * 24    // num of hours in a day
        * 60    // num of mins in an hour
return
    MinCount

Thanks. My issue is that I don't know the DAX to get "Slicer[Date]" since "Slicer" isn't recognized.

Anonymous
Not applicable

Since you have not given us any clue about your tables and their names... well, I used a generic name. You should now adjust it to your model.

Well, say I have a field for "Date of Incident". That may only have a few days in it. For instance one issue on 4/5/2021. The slicer might be looking from 3/15/2021 to 5/31/2021. If I do Max or Min on the Date of Incident, I will get 4/5 instead of the beginning or ending date in the slicer. I'm trying to target the actual date range in the slicer, not the records.

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.

Top Solution Authors