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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.