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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Maria929292
Frequent Visitor

Filter for a part of the matrix

Hi everyone,

 

I have 2 tables joined with one-to-many realtionships: one has an actual number of contracts, another has a target number. A matrix in the report looks like this:

Maria929292_1-1609174654530.png

 

 

"Fact type 1" and "fact all types" are from the same table.

I also have a filter by subtypes as every type has several subtypes.

 

Basically, I need to see

- contracts type 1/all actual contracts ratio

- contracts type 1/target number of contracts ratio

and the same with subtypes:

- contracts type 1(subtype 1)/all actual contracts ratio

- contracts type 1(subtype 1)/target number of contracts ratio

 

Obviously when I use filter by subtypes I get this:

Maria929292_2-1609174693949.png

 

It filters down values in all columns to the chosen subtype, but what I need is for "fact all types" and "target all types" remain unchanged and only "fact type " filtered down to the chosen subtype, like this: 

Maria929292_3-1609174740199.png

 

Could you help me with the way to achieve it, please?

Thank you.

 

 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Maria929292 

According to your description and sample pictures, I created some data to reproduced the problem you encountered in the Matrix. I think you can use measures to achieve your requirement. You can take a look at my method and find if it’s useful:

  1. I created the sample data and created the relationship according to your description:

v-robertq-msft_0-1609481760738.png

 

  1. Then I created these measures to place them into the Matrix:
fact type 2 =

COUNT('Fact'[fact type 1])
Fact all types1 =

SUMX(FILTER(ALL('Fact'),[Country]=MAX([Country])),[Fact all types])
Target all types1 =

CALCULATE(SUM(Target[Target all types]),FILTER(ALL('Fact'),[Country]=MAX([Country])))
% type 1 out of all types =

DIVIDE([fact type 2],[Fact all types1])
% target type 1 out of all types =

DIVIDE([fact type 2],[Target all types1])
  1. Create a Slicer and place [subtype] then a Matrix and place it like this:

v-robertq-msft_1-1609481760747.png

 

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hi, @Maria929292 

According to your description and sample pictures, I created some data to reproduced the problem you encountered in the Matrix. I think you can use measures to achieve your requirement. You can take a look at my method and find if it’s useful:

  1. I created the sample data and created the relationship according to your description:

v-robertq-msft_0-1609481760738.png

 

  1. Then I created these measures to place them into the Matrix:
fact type 2 =

COUNT('Fact'[fact type 1])
Fact all types1 =

SUMX(FILTER(ALL('Fact'),[Country]=MAX([Country])),[Fact all types])
Target all types1 =

CALCULATE(SUM(Target[Target all types]),FILTER(ALL('Fact'),[Country]=MAX([Country])))
% type 1 out of all types =

DIVIDE([fact type 2],[Fact all types1])
% target type 1 out of all types =

DIVIDE([fact type 2],[Target all types1])
  1. Create a Slicer and place [subtype] then a Matrix and place it like this:

v-robertq-msft_1-1609481760747.png

 

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Maria929292 , use all for selected column or removefilters

 

calculate([Measure], all(Table[Col1]))

 

refer

https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.