Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
what is the dax query for all values except the selected range
I want to get the value of exp - current which are 2 other measures for the non selected range, 0 to 3(min_hour) and 16 to 23(max_hour) and sum the values for both those non selected ranges
Try
Sum outside range =
VAR MinHour =
MIN ( 'Time'[Hour] )
VAR MaxHour =
MAX ( 'Time'[Hour] )
VAR ValueMinHour =
CALCULATE ( [My measure], 'Time'[Hour] < MinHour )
VAR ValueMaxHour =
CALCULATE ( [My measure], 'Time'[Hour] > MaxHour )
RETURN
ValueMinHour + ValueMaxHour
It is returning Null...
What should it be returning? Are any other slicers or filters affecting the calculation ?
it should get the hours from 0 to min, and max to end value 23, and based on that filtered value, I have to caluclate my measure expenditure - current
That's what it is supposed to do. The 'Time'[Hour] column is intended to be the column you are using in the slicer.
yeah, that is what its supoosed to do, i tried filtering it out also in the same way, but even if the value < start and >end exists, it is returning blak/null, and calculation is not affected by any other slicer
Try creating a temporary table like
Tmp table =
ADDCOLUMNS ( VALUES ( 'Time'[Hour] ), "My Measure", [My Measure] )
and that should confirm whether the base measure is working or not
for this, i am getting for every hour in one column, corresponding measure exp - cur
i created a new table of existing and tried filtering out by min val and max val, but it is considering min as 0 and max as 23, that's why its returning blank... it is not taking the slicer min or max when i take it in another measure, but when i put a card and check for minval and maxval it is properly working
Use Performance Analyzer to get the DAX code for the visual which isn't working, and paste it into DAX Studio. That will show you which filters are being applied, and will show whether the slicer is affecting it or not. If it isn't then you need to have a look at Edit Interactions to make sure that the slicer values do get passed across.
I tried that too, it is getting passed to the required charts too...
can you share a PBIX with any confidential info removed ?
I am not in the position to share the file, sorry... the min and max of slicer whenever i use in any calculation is giving 0 and 23(start and end) even if the slicer is changed
Are you sure you're doing the MIN / MAX as a measure and not as a calculated column? Measures should definitely be affected by slicers but columns will not be
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
25 | |
20 | |
18 | |
18 | |
17 |
User | Count |
---|---|
36 | |
22 | |
19 | |
18 | |
11 |