powerbi - Use Slicer selection in calculated column (Parameter) -


i have: - slicer dates , table 'log' column 'date' dates , column 'max' numbers (e.g. 0,31)

i need calculate average of values in column 'max' when date before slicer selection date - , average after.

end result: card visualisation average of values before selected date , card visualisation average of values after selected date.

create 3 measures:

avg = average('log'[max]) 


averageafterselecteddate = calculate (     [avg],     filter ( ( 'log' ), [date] > minx ( 'log', 'log'[date] ) ) ) 


averagebeforeselecteddate = calculate (     [avg],     filter ( ( 'log' ), 'log'[date] < minx ( 'log', [date] ) ) ) 

just use averagebeforeselecteddate , averageafterselecteddate measures in cards.

for data:

enter image description here

it produces:

enter image description here

let me know if helps.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -