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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Malick2018
Frequent Visitor

Multiple columns and values in Matrix

Hello,

 

I'm trying to achieve the below in Power BI Matrix. My GENDER column has possible 'male' and 'female' values for each office. Next 4 columns, TABLEAU, POWER BI, MS EXCEL and SPSS are 4 different columns of my dataset with numeric values. I can pull multiple columns and values using COUNTIFS in excel, however I am astruggling to achieve this in Power BI. Thank you for providing any help. 

 

PowerBI_matrix.jpg

1 ACCEPTED SOLUTION

@Malick2018,

Here are the steps:

1. Added an index column to the PowerBI_Ready table.

2. Duplicated the table using 'Reference' option and renamed it PowerBI-Ready_Gender.

3. Unpivoted the PowerBI_Ready_Gender table.

4. Power BI will automatically create the relationship between these two tables using the Index column.

5. Add the below two Measures in the PowerBI_Ready_Gender table.

 

Male = CALCULATE(COUNT(PowerBI_Ready_Gender[Gender]), PowerBI_Ready_Gender[Gender]="Male", PowerBI_Ready_Gender[Value]>0)

 

Female = CALCULATE(COUNT(PowerBI_Ready_Gender[Gender]), PowerBI_Ready_Gender[Gender]="Female", PowerBI_Ready_Gender[Value]>0)

 

The result:

PowerBIGender.JPG

 

Download the Power BI file here.

 

View solution in original post

7 REPLIES 7
v-jiascu-msft
Employee
Employee

Hi @Malick2018,

 

Can you please share a dummy sample of the original data?

 

Best Regards,

Dale

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

Hi @v-jiascu-msft, Here is the sample dataset. Thanks.

 

Sample data

anandav
Skilled Sharer
Skilled Sharer

@Malick2018,

Can you detail a bit more what is the result you want to achieve and some sample result?

@anandav, Thanks. Please see the below image. I have been able to achieve this in Power BI, pretty easy. I added data from field named SOFTWARE USED and added in the column and values field of the matrix. 

Pic1.jpg

I want to add another field from my dataset named GENDER, and achive the results as displayed below (blue rectangle), where in the matrix it should list the number of male and female staff by Office / Region (once only). The problem is when I add the GENDER field in columns / values field of matrix, the number of male / female are being repeated for each SOFTWARE. So I get male/ female for tableau, male / female for Power BI. I only need the MALE / FEMALE numbers to appear once. I hope I was able to make it clear. Thanks.  

 

 

result.jpg

@Malick2018,

Here are the steps:

1. Added an index column to the PowerBI_Ready table.

2. Duplicated the table using 'Reference' option and renamed it PowerBI-Ready_Gender.

3. Unpivoted the PowerBI_Ready_Gender table.

4. Power BI will automatically create the relationship between these two tables using the Index column.

5. Add the below two Measures in the PowerBI_Ready_Gender table.

 

Male = CALCULATE(COUNT(PowerBI_Ready_Gender[Gender]), PowerBI_Ready_Gender[Gender]="Male", PowerBI_Ready_Gender[Value]>0)

 

Female = CALCULATE(COUNT(PowerBI_Ready_Gender[Gender]), PowerBI_Ready_Gender[Gender]="Female", PowerBI_Ready_Gender[Value]>0)

 

The result:

PowerBIGender.JPG

 

Download the Power BI file here.

 

anandav,

Thank for the method. For Statuc values like Gender, this method is OK.

What if we need to get the dynamic column and its values in Matrix?

Ex:

(Static Columns)

Gender: Male and Female

Software: SSRS, PowerBI, Tableau

 

(DYnamic COlumns)

SoftwareSSRS, PowerBI, Tableau , n......

Clients: IBM, TCS, Infosys, CTS, n.....

@anandav, Thank you, it works. Your help is appreciated. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.