Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello All,
I've created a below measure (there are 4-5 switch cases but I've shorten it to one only) which is working fine untill and unless I apply "Sort by column" to sort "attribute" column with the help of another "sort" column once I apply sorting then the value of this measure goes blank, I observed the reason behind this behavious is whenever I remove the filter condition ('Data Table'[Attribute] = "PTD_Actual") from measure and sort it then it will work fine but if I keep the filter condition and then sort it then it goes blank,
It seems like either filter will work or else sorting will work but I need both here, please see the DAX measure and screenshots for reference below
Without sort - please see highlighted content only
With sort
Solved! Go to Solution.
You need the REMOVEFILTERS in the measure definition,
Insights =
VAR dateV =
SELECTEDVALUE ( calendarDate[AS_ON_DATE] )
VAR calc =
CALCULATE (
SUM ( 'Data Table'[Value] ),
TCH_TIME_DIM[AS_ON_DATE] = dateV,
'Data Table'[Attribute] = "PTD_Actual",
REMOVEFILTERS ( 'Data Table'[Attribute sort] )
)
VAR SwitchV =
SWITCH ( MAX ( 'Data Table'[Attribute] ), "Daily-Actual", calc )
RETURN
SwitchV
Inside the CALCULATE try adding REMOVEFILTERS on the column which you are using to sort by.
Thanks for your response @johnt75 ,
For sorting I've tried both power query and DAX, the Dax statement is below and I'm not sure how to use REMOVEFILTERS inside calculate as I didn't used calculate function,
Could you please explain it more,
Thanks,
Dinky
You need the REMOVEFILTERS in the measure definition,
Insights =
VAR dateV =
SELECTEDVALUE ( calendarDate[AS_ON_DATE] )
VAR calc =
CALCULATE (
SUM ( 'Data Table'[Value] ),
TCH_TIME_DIM[AS_ON_DATE] = dateV,
'Data Table'[Attribute] = "PTD_Actual",
REMOVEFILTERS ( 'Data Table'[Attribute sort] )
)
VAR SwitchV =
SWITCH ( MAX ( 'Data Table'[Attribute] ), "Daily-Actual", calc )
RETURN
SwitchV
It worked, Thank you so much @johnt75
Also, if you could share the reason behind this behavious that would be awesome.
Thanks again,
Regards,
Dinky
When you set a column to be sorted by another column, any time the first column is used in a visual the sort by column is also added to the DAX query used to generate the data, even if the sort by column doesn't appear visually. This means that for any given data point both the first column and the sort by column are in the filter context. If you wish to manipulate the filter context to remove or change the first column, you need to take care of the sort by column too.
Alright, Got it.
Thanks for your time and solution
Regards,
Dinky
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.