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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

slicer, non selected values in range slicer from a between slicer

what is the dax query for all values except the selected range

Amirtha_0-1682322732648.png

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

14 REPLIES 14
johnt75
Super User
Super User

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

It is returning Null... 

What should it be returning? Are any other slicers or filters affecting the calculation ?

Anonymous
Not applicable

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.

Anonymous
Not applicable

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

Anonymous
Not applicable

for this, i am getting  for every hour in one column, corresponding measure exp - cur

Anonymous
Not applicable

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.

Anonymous
Not applicable

I tried that too, it is getting passed to the required charts too...

can you share a PBIX with any confidential info removed ?

Anonymous
Not applicable

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.