Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone,
I have a very weird problem which is either due to the fact that I've instantly forgotten how DAX works or it's some kind of bug
I have this two measures in my model
Solved! Go to Solution.
Hi @Anonymous ,
Yes, if you first use the "Sort by column" function to sort a column, the ALL() function will not remove the filter on this column.
Sort [Brand] column
Do not sort [Brand] column
The reason may be that the "Sort by column" feature also fixes a filter on this column, something like this:
Test =
CALCULATE(
[Product],
FILTER(
ALL(Sales),
Sales[Brand] = SELECTEDVALUE(Sales[Brand])
)
)
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
In fact, when you add the ALL() function, [test]measure counts the number of rows in the entire table, because the ALL() function will also ignore the filters on the axis in the visual.
But the result of your this picture is very strange. Is your 'Opportunity Product' [Opportunity Stage] column a calculated column?
As tested, the ALL() function can also remove the filters on the calculated column.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
It works if I include in the ALL statement to remove the filter also the column that I use to orderby
I guess it's not a bug but I didn't know that to remove the filter with calculate you needed to include also the column that sorts the column you have on the axis
This is what is happening basically:
I have recreated Opportunity Stage as last column in my table even though it is used in other columns before
When I try to sortbycolumn with a previous column, every calculated column goes in "error" and the error message tells me that the column I am using to sort needs to be recalculated
I refresh the data and everything goes back to being fine, but when I try to use the opportunity stage column in my axis now the ALL function to ignore the filter context doesn't work anymore
Hi @Anonymous ,
Yes, if you first use the "Sort by column" function to sort a column, the ALL() function will not remove the filter on this column.
Sort [Brand] column
Do not sort [Brand] column
The reason may be that the "Sort by column" feature also fixes a filter on this column, something like this:
Test =
CALCULATE(
[Product],
FILTER(
ALL(Sales),
Sales[Brand] = SELECTEDVALUE(Sales[Brand])
)
)
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I literally just CTRL+C the code, deleted the column and recreated with CTRL+V and now it works
I guess it was a bug? I don't know. I'll wait on a moderator and then eventually delete the post
Very weird behavior though
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
95 | |
77 | |
65 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |