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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Matrix - Add Column to separate 2 measures

 

Hi, 

 

I am fairly new to Power Bi.

 

Please see below Matrix for both Male and Female and by their different Groups. How do I insert another blank column after the total column? 

 

Table.PNG

 

If this can't be done, would it be possible to have the values for female in Blue and the Male Values in Red? See table  I have produced in excel. 

 

Table2.PNG

 

 

 

Thank you, 

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

@Anonymous ,

 

Create a measure using dax like pattern below:

Measure = SWITCH(SUM('Table'[Value]), CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Gender] = "Male")), "Blue", CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Gender] = "Female")), "Red")

And then open conditional formatting and select Field Value based on the Measure above:

Capture.PNG  

 

You can also refer to the pbix file.

 

Community Support Team _ Jimmy Tao

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

10 REPLIES 10
Anonymous
Not applicable

Hi I have tried that formula and it does not seem to work. Is there anything else I could try?

 

All the values in the table are caluclated by measures if that helps? 

 

Thank you, 

 

@v-yuta-msft 

@Anonymous 

@Anonymous ,

 

You mean the in the "value field" of the matrix visual is measure, not the aggregation of raw data, right? If so, you need to convert the measure to calculate column to make the solution I post above work.

 

Community Support Team _ Jimmy Tao

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

 

 

Anonymous
Not applicable

 

That worked thank you!! Only problem I have now is to show the 0 value in my table, any idea on how this is done? I know in excel you could write a formula IFBLANK. 

 

See snippet below. 

 

Capture.PNG

 

Thank you once again. 

@v-yuta-msft 

@Anonymous 

@Anonymous ,

 

Just add +0 at the end of the calculate column.

 

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

Hi, 

 

My raw data has no blanks but when I create a measure to include everything in my matrix there are some fields which are blank, are you sure +0 will work, I don't think it will as there are no gaps. 

 

Thank you 

@v-yuta-msft 

@Anonymous ,

 

You can use ISBLANK() function in power bi, please refer to:

https://docs.microsoft.com/en-us/dax/isblank-function-dax

 

Community Support Team _ Jimmy Tao

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

v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Create a measure using dax like pattern below:

Measure = SWITCH(SUM('Table'[Value]), CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Gender] = "Male")), "Blue", CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Gender] = "Female")), "Red")

And then open conditional formatting and select Field Value based on the Measure above:

Capture.PNG  

 

You can also refer to the pbix file.

 

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

Just with a quick view and no experiment made I would make a measure if(gender="f",1,0) and would conditional formatting,

 

Let me know if it worked, if not I'll take a Deeper look 😀

 

BR,

DR

Anonymous
Not applicable

Hi,

 

That did not work, it came up with an error message.

 

"The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."

 

Thank you @Anonymous 

Anonymous
Not applicable

Hello,

Can you show a field selected pane so I can see how's your data is structured?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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