Power BI: show the amount of a specific value when selected in a column chart

To show the amount of a specific selected value, I have different options. Based on what I want to do, I will use one of them. This DAX formula shows only the value of the specific selected object, it will not show the total or if I select more than one:

CALCULATE(SUM('table'[argument1]),FILTER('table','table'[argument2]=SELECTEDVALUE('table'[argument2])))

To see the result, first I will create a measure by clicking on “home -> new measure” and put the formula. Secondly, I will create a “card” in the visualization and in the “fields”, I put the “measure”.

power bi power bi
power bi power bi power bi

This one will display the same result, the difference is that there is a variable that I can define for a particular object if I want:

var qrtsel=SELECTEDVALUE('table'[argument1])
return CALCULATE(SUM('table'[argument2]),FILTER('table','table'[argument1]=qrtsel))

power bi

In this example, I only show 1 chart but imagine that I have 2 charts, one with “axis = quarter” ('trend'[Quarter]) and the other one with “axis = month” ('trend'[Month]). If I select something in the month chart, it will not interfere with the quarter one.

This DAX formula will show the value no matter what I will select or not:

IF(HASONEVALUE('table'[argument1]),CALCULATE(SUM('table'[argument2]),FILTER('table','table'[argument1]=
SELECTEDVALUE('table'[argument1]))),SUM('table'[argument2]))

power bi
power bi power bi power bi

Interesting Management