Forum Discussion
Dax function ignores slicer
Hello,
I have the following measure that works fine.
asdasd
% Pageviews =
VAR _max =
CALCULATE (
MAX ( 'nw_content'[Week_Start_Date] ),
FILTER (
ALL ( 'nw_content' ), [Author_Clm] = MAX ( [Author_Clm] ) && [Week_Start_Date] < MAX ( [Week_Start_Date] )
)
)
VAR _pir =
CALCULATE (
SUM ( [Pageviews] ),
FILTER (
ALL( 'nw_content' ), [Author_Clm] = MAX ( [Author_Clm] ) && [Week_Start_Date] = _max )
)
VAR _result =
DIVIDE ( SUM ( [Pageviews] ), _pir ) - 1
RETURN
IF ( _result = -1, "no data", _result )
My problem is that when i try to use any filter the results are wrong. From what i understand is the function all i use here:
- Hello polman4,Try the below Measure:diff =var _max = CALCULATE(MAX('Table'[Column]), FILTER(ALLEXCEPT('Table', 'Table'[Type]), [author] = MAX([author])&& [Column] < MAX([Column])))var _pir= CALCULATE(SUM([value]), FILTER(ALLEXCEPT('Table', 'Table'[Type]), [author] = MAX([author])&& [Column] = _max))var _result= DIVIDE(SUM([value]), _pir) - 1return IF(_result = -1, BLANK(), _result)
9 Replies
- ReneMoawadResolver III
- polman4Helper I
Hello ReneMoawad
Thank you for the reply. Didn't really understand what change to do. What part of code to replace?
Thank you
- ReneMoawadResolver III
Instead of using ALL('nw_content') you can use ALL('nw_content'[Author_Clm], 'nw_content'[Week_Start_Date])
% Pageviews =
VAR _max =
CALCULATE (
MAX ( 'nw_content'[Week_Start_Date] ),
FILTER (
ALL('nw_content'[Author_Clm], 'nw_content'[Week_Start_Date]), [Author_Clm] = MAX ( [Author_Clm] ) && [Week_Start_Date] < MAX ( [Week_Start_Date] )
)
)
VAR _pir =
CALCULATE (
SUM ( [Pageviews] ),
FILTER (
ALL('nw_content'[Author_Clm], 'nw_content'[Week_Start_Date]), [Author_Clm] = MAX ( [Author_Clm] ) && [Week_Start_Date] = _max )
)
VAR _result =
DIVIDE ( SUM ( [Pageviews] ), _pir ) - 1
RETURN
IF ( _result = -1, "no data", _result )
- polman4Helper I
This gives me back no data for the variable _pir 😕