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
Thor2022
Frequent Visitor

Filter the contents inside MATRIX visual

Dear All 

I have a matric that contains the following information: 

- Rows: Warehouse names: A, B and C 

- Columns: Years 

- Values: Profits 

 

and I have a multiselection slicer that contains the Warehouse names. 

 

I want to be able to compare the chosen values in the slicer and see the result in the Matrix in a way that the MATRIX will only show comparison if they are different, but if they are identical it will show blank, this is an example 

Thor2022_0-1665754676396.png

 

Thanks in advance 

Regards 

 

 

1 ACCEPTED SOLUTION

@Thor2022 

Actually, thinking about it, the average method could potentially not achieve what you are looking for.

If you have a set of values for a year like {30, 29, 30, 31}, the average method will hide both 30 values.

The following  method however will work: compare the minimum value in a set to the maximum value. If they are the same, all values are the same...

So...

 

No duplicate profits =
VAR _Min =
    MINX ( ALL ( 'Warehouse table'[Warehouse] ), [Your measure] )
VAR _MAX =
    MAXX ( ALL ( 'Warehouse table'[Warehouse] ), [Your measure] )
RETURN
    IF (
        AND (
            ISINSCOPE ( 'Warehouse table'[Warehouse] ),
            ISINSCOPE ( 'Year Table'[Year] )
        ),
        IF ( _Min = _Max, BLANK (), [Your measure] )
    )

 

 

PS. I tried deleting the previous message but the forum won't let me for that particular post for some reason....

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

10 REPLIES 10
pi_eye
Resolver IV
Resolver IV

Hi Thor

 

Can you elaborate on the example? So for example if the column values for year #2 are 5,6 and 7, it shows but if it is 3,3, and 3  it is blank?

 

See example below:

pi_eye_0-1665764589423.png

 

Try this expresion in DAX:

Show diff Values = If(Calculate(DISTINCTCOUNT(WareHouse[Value]),ALLSELECTED(WareHouse[WareHouse]))=1,"", Sum(WareHouse[Value]))

 

What it is doing:

Calculate(DISTINCTCOUNT(WareHouse[Value]),ALLSELECTED(WareHouse[WareHouse])) --> Gives you the total of distinct values per warehouse

If(....... =1,"",...) ---> tests for the distinct values =1, thie means they are all the same. Returns blank if that is the case, and the sum if they are different.

 

 

 

Thanks,

 

Pi

Hi Pi

Thanks a lot, I will try it on Monday. 

Until then, I just need to add that the profit value is a measure, not a column .. so I am not sure if this DAX can be applied? 

Thanks a gain 

Regards 

Hi @Thor2022 

 

This is interesting, because for some reason it's not as simple to aggregate a distinct count on another measure! However it is always possible in DAX 😉

 

 

I created a new measure rather than chain it in called "New count" which evaluates to the total number of distinct sums. I am use group by to create an aggregated table which I can pass the summed column through to a  distinct count.

New Count = calculate(
        countx(
            distinct(SELECTCOLUMNS( GROUPBY(WareHouse,WareHouse[WareHouse],"SumVal",sumx(CURRENTGROUP(),WareHouse[Value])),[SumVal]) ) ,
            [SumVal] ),
        ALLSELECTED(WareHouse[WareHouse])
)
 
On it's own, it looks like this: (sorry I can't seem to cut and paste images right now)
 12345678 
WH142123333 
WH242123333 
WH342123333 
WH442123333 
          
 

Added into the final expression gives you: 

Show diff Values = If([New Count]=1,"", Sum(WareHouse[Value]))

 

Let me know if this works,

Pi

Here is one way. Basically you compare the sum (profit) of each warehouse with the average for all warehouses in a year.

First the model:

model.png

 The calculation (without totals)

 

No duplicate profits =
VAR _Profit =
    SUM ( fTable[Profit] )
VAR _Average =
    CALCULATE ( AVERAGE ( fTable[Profit] ), ALL ( 'Warehouse table'[Warehouse] ) )
RETURN
    IF (
        AND (
            ISINSCOPE ( 'Warehouse table'[Warehouse] ),
            ISINSCOPE ( 'Year Table'[Year] )
        ),
        IF ( _Profit = _Average, BLANK (), _Profit )
    )

 

and if you need totals:

 

No Dups with totals = 
SUMX(SUMMARIZE(fTable, 'Warehouse table'[Warehouse], 'Year Table'[Year]), [No duplicate profits])

 

result.png

 

Sample PBIX attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi Paul 

Thank you for your reply .

I find the logic in your solution excellent but as I mentioned before, the Profit value is a measured value that can't be calculated in the average function !!! 
looking forward to your reply 

REgards 

My apologies. I did see you mention it and then promptly forgot about it in the solution.

This measure will work:

No duplicate profits =
VAR _Profit = [Your measure]
VAR _Average =
    AVERAGEX ( ALL ( 'Warehouse table'[Warehouse] ), [Your measure] )
RETURN
    IF (
        AND (
            ISINSCOPE ( 'Warehouse table'[Warehouse] ),
            ISINSCOPE ( 'Year Table'[Year] )
        ),
        IF ( _Profit = _Average, BLANK (), _Profit )
    )




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@Thor2022 

Actually, thinking about it, the average method could potentially not achieve what you are looking for.

If you have a set of values for a year like {30, 29, 30, 31}, the average method will hide both 30 values.

The following  method however will work: compare the minimum value in a set to the maximum value. If they are the same, all values are the same...

So...

 

No duplicate profits =
VAR _Min =
    MINX ( ALL ( 'Warehouse table'[Warehouse] ), [Your measure] )
VAR _MAX =
    MAXX ( ALL ( 'Warehouse table'[Warehouse] ), [Your measure] )
RETURN
    IF (
        AND (
            ISINSCOPE ( 'Warehouse table'[Warehouse] ),
            ISINSCOPE ( 'Year Table'[Year] )
        ),
        IF ( _Min = _Max, BLANK (), [Your measure] )
    )

 

 

PS. I tried deleting the previous message but the forum won't let me for that particular post for some reason....

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Great work 

Highly appricated 

Hi @Thor2022 

 

This is interesting, because for some reason it's not as simple to aggregate a distinct count on another measure! However it is always possible in DAX 😉

 

I created a new measure rather than chain it in called "New count" which evaluates to the total number of distinct sums. I am use group by to create an aggregated table which I can pass the summed column through to a  distinct count.

New Count = calculate(
        countx(
            distinct(SELECTCOLUMNS( GROUPBY(WareHouse,WareHouse[WareHouse],"SumVal",sumx(CURRENTGROUP(),WareHouse[Value])),[SumVal]) ) ,
            [SumVal] ),
        ALLSELECTED(WareHouse[WareHouse])
)
 
On it's own, it looks like this: (sorry I can't seem to cut and paste images right now)
 12345678 
WH142123333 
WH242123333 
WH342123333 
WH442123333 
          
 

Added into the final expression gives you: 

Show diff Values = If([New Count]=1,"", Sum(WareHouse[Value]))

 

Let me know if this works,

Pi

Hi Pi 

I am sure its a great solution , but give me some time to digest it , since some of the used functions are new for me 🙂 

Regards 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.