Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vsahin
Helper I
Helper I

Compare values against selected item in matrix visual

Hi All,

 

I have a simple data set as below.

 

vsahin_1-1713274711087.png

 

 

I want to add a slicer. When I choose a city from this slicer I want Sum of Price Column stay as it is(not filtered) but Total Price for selected City shows data for City A only.

 

vsahin_0-1713274620428.png

My final goal is to see below visual.

 

 

vsahin_0-1713275316186.png

 

I think I need to create another table for city and leave it not connected and create a measure but couldn't figure it out. 

 

Thanks in advance.

1 ACCEPTED SOLUTION
_AAndrade
Super User
Super User

Hi @vsahin,

Here is my solution:

1 - Create a new table with all City names like this:

_AAndrade_0-1713278017738.png

And use this new table as a slice in the report like this:

_AAndrade_1-1713278078747.png

 

 

After that create this new two measures:

SumPrice = SUM(T_CityData[Price])

NewSumCity = 
VAR _City = SELECTEDVALUE('T_CityData Off'[City])
VAR _Result = 
CALCULATE(
    [SumPrice],
    FILTER(
        ALL(T_CityData), 
        T_CityData[City] = _City && T_CityData[Item] = SELECTEDVALUE(T_CityData[Item])
    )
)

RETURN
_Result

Build your matrix table like this:

_AAndrade_2-1713278151292.png


And it should works like you want.

Note: You always need to have one City selected and have only one City selected on the slicer.

 

 





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




View solution in original post

3 REPLIES 3
_AAndrade
Super User
Super User

You're welcome.





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




_AAndrade
Super User
Super User

Hi @vsahin,

Here is my solution:

1 - Create a new table with all City names like this:

_AAndrade_0-1713278017738.png

And use this new table as a slice in the report like this:

_AAndrade_1-1713278078747.png

 

 

After that create this new two measures:

SumPrice = SUM(T_CityData[Price])

NewSumCity = 
VAR _City = SELECTEDVALUE('T_CityData Off'[City])
VAR _Result = 
CALCULATE(
    [SumPrice],
    FILTER(
        ALL(T_CityData), 
        T_CityData[City] = _City && T_CityData[Item] = SELECTEDVALUE(T_CityData[Item])
    )
)

RETURN
_Result

Build your matrix table like this:

_AAndrade_2-1713278151292.png


And it should works like you want.

Note: You always need to have one City selected and have only one City selected on the slicer.

 

 





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




@_AAndrade thanks for the quick response this sorted out the issue.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.