Forum Discussion
Previous Same WeekDay Averge
- 7 years ago
v-lili6-msft Thanks, your correct, but I forget something very important ,
I have a one column of TYPE, Wireless and Wireline, and I have a slicer to show only one of both,
you DAX is taking both value, How I can modify your DAX to included just the values is selected by the slicer?
- 7 years ago
hi SQUILES
First, you must know that calculated column and calculate table can't be affected by any slicer.
Notice:
1. Calculation column/table not support dynamic changed based on filter or slicer.
2. measure can be affected by filter/slicer, so you can use it to get dynamic summary result.
here is reference:
https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/
Second, you could use a measure instead of it by this formula:Measure 2 = CALCULATE ( AVERAGE('M7 Wireline_Wireless'[DATO_46]), FILTER ( ALLSELECTED( 'M7 Wireline_Wireless'), DATEDIFF ( 'M7 Wireline_Wireless'[DATA_PERIODO], MAX('M7 Wireline_Wireless'[DATA_PERIODO]), MONTH ) = 1 && WEEKDAY ( 'M7 Wireline_Wireless'[DATA_PERIODO], 1 ) = 2 ))Best Regards,
Lin
v-lili6-msft Thanks, your correct, but I forget something very important ,
I have a one column of TYPE, Wireless and Wireline, and I have a slicer to show only one of both,
you DAX is taking both value, How I can modify your DAX to included just the values is selected by the slicer?
hi SQUILES
First, you must know that calculated column and calculate table can't be affected by any slicer.
Notice:
1. Calculation column/table not support dynamic changed based on filter or slicer.
2. measure can be affected by filter/slicer, so you can use it to get dynamic summary result.
here is reference:
https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/
Second, you could use a measure instead of it by this formula:
Measure 2 =
CALCULATE (
AVERAGE('M7 Wireline_Wireless'[DATO_46]),
FILTER (
ALLSELECTED( 'M7 Wireline_Wireless'),
DATEDIFF (
'M7 Wireline_Wireless'[DATA_PERIODO],
MAX('M7 Wireline_Wireless'[DATA_PERIODO]),
MONTH
) = 1
&& WEEKDAY ( 'M7 Wireline_Wireless'[DATA_PERIODO], 1 ) = 2
))
Best Regards,
Lin