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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

slicer

I want to take the start and end value of the slicer for hour like this, i want to take start and end dynamically, how to dax query it

Amirtha_0-1682155661704.png

 

4 REPLIES 4
HassanAshas
Helper V
Helper V

You can use MIN and MAX functions for this, 

To get Min Hour Value, 

 

Min_Hour = MIN(Table[Hour])

 

To get Max value, 

 

MAX_Hour = MAX(Table[Hour])
Anonymous
Not applicable

Ok, i've done it, how to take the values other than the selected range, from 0 to that Min_hour and max_hour to 23

Do you want to take all the values, or only the Min and Max value before the Min_Hour? 

If you want to take all values in form of tables, then you can use the following, 

 

var _MinHour = MIN (Table[Hour])
var _MaxHour = MAX (Table[Hour])

_UnderMin = 
    FILTER(
        DISTINCT (ALL(Table[Hour])), 
        Table[Hour] < _MinHour
    )

_AboveMax = 
    FILTER(
        DISTINCT (ALL(Table[Hour])), 
        Table[Hour] > _MaxHour
    )

 

The _UnderMin will return you all the values below the Minimum selected value and _AboveMax will return all the values greater than the selected value. 

 

If you want the Minimum value (0), Max value below the Selected Minimum Value, Minimum value selected above the Selected Max Value (24) and the Max Value, you can use the following DAX Codes, 

 

var _MinHour = MIN (Table[Hour])
var _MaxHour = MAX (Table[Hour])

_MinHourAllValues = MIN (ALL(Table[Hour]))
_MaxHourAllValues = MAX (ALL(Table[Hour]))

_Max_Value_Below_Minimum = 
    MAXX (
        FILTER (
               ALL(Table),
                
        Table[Hour]
    )
    
_Max_Value_Below_Minimum = 
    MAXX (
        FILTER (
            DISTINCT (ALL(Table[Hour])), 
            Table[Hour] < _MinHour
        ), 
        Table[Hour]
    )
    
_Min_Value_Above_Maximum = 
    MINX (
        FILTER (
            DISTINCT (ALL(Table[Hour])), 
            Table[Hour] > _MaxHour
        ), 
        Table[Hour]
    )
Anonymous
Not applicable

I tried this, the issue I am facing is, when i try undermin in another measure to calculate exp - current, I am getting blank values cz it is taking 0 as minhour and 23 as maxhour even when i select from a range...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.