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'[argument]),FILTER('table','table'[argument]=SELECTEDVALUE('table'[argument])))

NOTE: change “table” and “argument” by yours. As you can see in the picture, I put mine.

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'[argument])
return CALCULATE(SUM('table'[argument]),FILTER('table','table'[argument]=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'[argument]),CALCULATE(SUM('table'[argument]),FILTER('table','table'[argument]=SELECTEDVALUE('table'[argument]))),SUM('table'[argument]))

power bi
power bi power bi power bi

Interesting Management