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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
RichOB
Post Patron
Post Patron

Need help combining categories of a column into a measure and renaming them

Hi, I need to group the 3 general ledger codes below to "Income" and have a slicer with the location. 

I have grouped them by using:

Income_ = CALCULATE(
    SUM('Table'[Amount]),
    KEEPFILTERS(Table [General_Ledger_Code] IN {"101", "102", "103"}))

How do I rename these as Income within the measure? I thought that they would appear as the title name "Income_", but they are listing individually in a matrix table.
 
Orignial data table
General_Ledger_Code NameAmountLocation
101Donations1000Manchester
102Contract Income 50,000Manchester
103Investment Income100,000Manchester
101Donations20,000Edinburgh
102Contract Income 30,000Edinburgh
103Investment Income40,000Edinburgh
 
 
This is how I want it to look
TypeLocatonTotal
IncomeManchester160,000
IncomeEdinburgh90,000

Thanks
1 ACCEPTED SOLUTION
ChielFaber
Solution Supplier
Solution Supplier

The easiest way is to add a calculated column to your table. Click add column and as an example you can use the following dax code:

Type =
SWITCH(
TRUE(),
'Table'[General_Ledger_Code] IN {"101", "102", "103"}, "Income",
"Other"
)

This will add a new column to the data that states Income. You can then drop this into your visual.

View solution in original post

5 REPLIES 5
v-veshwara-msft
Community Support
Community Support

Hi @RichOB ,

Following up to see if your query has been resolved. If any of the responses helped, please consider marking the relevant reply as the 'Accepted Solution' to assist others with similar questions.

If you're still facing issues, feel free to reach out.

Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @RichOB ,

Thank you for engaging with the Microsoft Fabric Community.

Just following up to check if your query has been resolved and whether the responses were helpful. If so, please consider marking the helpful replies as Accepted Solutions to assist others with similar queries.

If further assistance is needed, please reach out.
Thank you.

danextian
Super User
Super User

Hi @RichOB 

 

Your measure creates aggregates the amount column based on GL codes that are you in your list of Income codes. It doesn't identify the code as whether it is income or not.

 

You can try this measure:

 

IF (
    SELECTEDVALUE ( 'Table'[General_Ledger_Code] ) IN { "101", "102", "103" },
    "Income",
    "Other"
)

 

Please note that measures cannot be used as a dimension or in a slicer as their result depends on the other dimension added to a visual. If you want to be able to use that as a dimension, create a calculated column instead

 

IF (
    'Table'[General_Ledger_Code] IN { "101", "102", "103" },
    "Income",
    "Other"
)

 

danextian_0-1741166772694.png

Use the calculated column in your visual.

danextian_2-1741166912492.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
MattiaFratello
Solution Supplier
Solution Supplier

Hi @RichOB, why not creating a group or even a new column?

https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-grouping-and-binning

https://learn.microsoft.com/en-us/power-query/add-conditional-column

 

Then you can use either the group or the new column in your matrix

 

Please let me know if you need additional examples

ChielFaber
Solution Supplier
Solution Supplier

The easiest way is to add a calculated column to your table. Click add column and as an example you can use the following dax code:

Type =
SWITCH(
TRUE(),
'Table'[General_Ledger_Code] IN {"101", "102", "103"}, "Income",
"Other"
)

This will add a new column to the data that states Income. You can then drop this into your visual.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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