Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
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])
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]
)
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...
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
8 | |
7 |