Sum of lasso selection from visual

Hi there,

I got a table (fact table) that has over 10 million rows. The table contains the half-hour value of power loss. I created a measure that calculates the average of power loss and displays it line chart visual. The measure looks as follow:

Average Power = Average (Fact[Power])

The x-axis contains the hour of the day (starting from 0 to 23). Hour data is coming from time table (dimension table). The visual looks as follow:

I enabled the rectangle lasso selection. I want to select the multiple hours from the line graph and create a new measure that displays the sum of those selected hours. In other words, the new measure shows the sum of the average power of selected hours.

I created a measure as follow:

Sum selected hours Power = SUMX(Fact,[Average Power])

However, the above measure did not produce the sum of selected hours of visual. Could anyone help me where am I making the mistake?

Sorry the file size is too big and internet speed is pathetic today so could not able to upload it.

Hi @leo_89, we aim to consistently improve the topics being posted on the forum to help you in getting a strong solution faster.

  • When posting a topic with formula make sure that it is correctly formatted to preformatted text </>.

image

  • Include the masked demo pbix file.

Not adhering to it may sometimes cause delay in getting an answer.

Here are some videos that may help you masking sensitive data and create datasets and data models representative of your problem:

@leo_89 ,

To get this to work, you just need to build out a bit of additional context in a short virtual table. We can use the same virtual table that we created in the thread about counting Lasso-selected points, but instead of COUNTROWS, we use SUMX to get the total of the points selected:

Sum of Points Selected =

VAR vTable =
ADDCOLUMNS(
    VALUES( Test[Date] ),
    "@valmeas", [value_measure]
)
VAR Result =
CALCULATE(
    SUMX( vTable, [@valmeas] ),
    ALLSELECTED( Test[Value] )
)
RETURN Result

I hope this is helpful. Full solution file attached.

1 Like