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
Depm
Regular Visitor

How to show different values in Matrix using filters from slicer

Hi All,

 

I've my data as below

 

MonthClientTeam A # of projectsTeam B # of projectsTeam A # of hitsTeam B # of hitsTeam A # of MissesTeam B # of Misses
JanXXX131234
JanYYY241234
FebXXX131234
FebYYY241234
MarXXX131234
MarYYY241234

 

I need couple of visuals on the report i.e. slicer with option "Overall", "Team A" and "Team B"

 

based on the value selected from slicer, below is how i want the matrix to be populated.

 

 Overall   
  JanFebMar
XXX# of projects444
 # of hits333
 # of misses777
YYY# of projects666
 # of hits333
 # of misses777
     
 Team A   
  JanFebMar
XXX# of projects111
 # of hits111
 # of misses333
YYY# of projects222
 # of hits111
 # of misses333
     
 Team B   
  JanFebMar
XXX# of projects333
 # of hits222
 # of misses444
YYY# of projects444
 # of hits222
 # of misses444

 

Please help me if there is any way i can create a seperate table using DAX so i can show data with different cuts in one singlt matrix with help of slicer. 

 

Thanks,

Deepak

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Depm 

 

The second method is to create a new table in Desktop using Dax.

New table = 
Var _table1=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team A","Type"," # of projects","Value",SUM('Table'[Team A # of projects]))
Var _table2=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team B","Type"," # of projects","Value",SUM('Table'[Team B # of projects]))
Var _table3=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team A","Type"," # of hits","Value",SUM('Table'[Team A # of hits]))
Var _table4=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team B","Type"," # of hits","Value",SUM('Table'[Team B # of hits]))
Var _table5=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team A","Type"," # of Misses","Value",SUM('Table'[Team A # of Misses]))
Var _table6=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team B","Type"," # of Misses","Value",SUM('Table'[Team B # of Misses]))
Return
UNION(_table1,_table2,_table3,_table4,_table5,_table6)

vzhangti_6-1692007838841.png

Result:

vzhangti_7-1692007898880.png

vzhangti_8-1692007926999.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @Depm 

 

The second method is to create a new table in Desktop using Dax.

New table = 
Var _table1=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team A","Type"," # of projects","Value",SUM('Table'[Team A # of projects]))
Var _table2=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team B","Type"," # of projects","Value",SUM('Table'[Team B # of projects]))
Var _table3=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team A","Type"," # of hits","Value",SUM('Table'[Team A # of hits]))
Var _table4=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team B","Type"," # of hits","Value",SUM('Table'[Team B # of hits]))
Var _table5=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team A","Type"," # of Misses","Value",SUM('Table'[Team A # of Misses]))
Var _table6=SUMMARIZE('Table','Table'[Month],'Table'[Client],"Team","Team B","Type"," # of Misses","Value",SUM('Table'[Team B # of Misses]))
Return
UNION(_table1,_table2,_table3,_table4,_table5,_table6)

vzhangti_6-1692007838841.png

Result:

vzhangti_7-1692007898880.png

vzhangti_8-1692007926999.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

v-zhangti
Community Support
Community Support

Hi, @Depm 

 

You can try the following methods. The first method in Power Query, Check the first two columns and select Unpivot Other Columns:

Step1:

vzhangti_1-1692006370926.png

Then:

vzhangti_0-1692006337428.png

Step2:

vzhangti_2-1692006940707.png

Then:

vzhangti_3-1692006957640.png

Then in the Power BI Desktop:

Overall:

vzhangti_4-1692007049440.pngvzhangti_5-1692007080343.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

parry2k
Super User
Super User

@Depm it is easier to unpivot the data and then you can visualize whatever the way you want, to test, start a new blank query -> advanced editor and paste the following M code

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMU9JRioiIAJKGQGwMpY2gbBOlWB2YqsjISKiMCVZVbqlJRJgFUUXILN/EIiLMgqjCa1YsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, Client = _t, #"Team A # of projects" = _t, #"Team B # of projects" = _t, #"Team A # of hits" = _t, #"Team B # of hits" = _t, #"Team A # of Misses" = _t, #"Team B # of Misses" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type text}, {"Client", type text}, {"Team A # of projects", Int64.Type}, {"Team B # of projects", Int64.Type}, {"Team A # of hits", Int64.Type}, {"Team B # of hits", Int64.Type}, {"Team A # of Misses", Int64.Type}, {"Team B # of Misses", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Month", "Client"}, "Attribute", "Value"),
    #"Inserted Text Before Delimiter" = Table.AddColumn(#"Unpivoted Other Columns", "Team", each Text.BeforeDelimiter([Attribute], " ", 1), type text),
    #"Inserted Text After Delimiter" = Table.AddColumn(#"Inserted Text Before Delimiter", "Type", each Text.AfterDelimiter([Attribute], " ", 1), type text),
    #"Removed Columns" = Table.RemoveColumns(#"Inserted Text After Delimiter",{"Attribute"})
in
    #"Removed Columns"

 

close and apply. Now you can use a matrix visual to see the data the way you want, and you can have a slicer on Team to filter on individual teams or see data for all the Teams together.

 

👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks you for providing the query syntax. I was wondering if this is possible using DAX? If yes, can someone please share the DAX syntax for the same problem. 

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! Prices go up Feb. 11th.

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.

Jan NL Carousel

Fabric Community Update - January 2025

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

Users online (2,000)