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
DOLEARY85
Resident Rockstar
Resident Rockstar

Multiple Formats in a Single Column with Calculating Totals

Hi all, 

 

I recently needed to have multiple formats in a single field where the totals and sub totals would calculate within a matrix, I couldn't find anything that matched exactly what I needed and after some trial and error I came up with the solution, so I thought i'd share in case someone else has the same issue. 

 

In the table I had two quantity fields which needed to be whole numbers and three currency fields (Profit, Total Cost and Total Sales). The DAX Measure below uses CONTAINSSTRING & SELECTEDVALUE to search for the word ‘Profit’ or ‘Total’ within the Attribute and applies a format of currency to the Value field while retaining the ability to calculate the totals by using 'FORMAT & SUM', to all other fields it applies a whole number while again retaining the ability to calculate totals.

 

DAX Expression:

Value Measure For Multiple Data Formats = IF(OR(CONTAINSSTRING(SELECTEDVALUE(Table'[Attribute]),"Profit"),CONTAINSSTRING(SELECTEDVALUE('Table'[Attribute]),"Total")),FORMAT(SUM(Table'[Value])),"£#,##0.#0"),FORMAT(SUM('Table'[Value])),"#"))

 

If you're interested in why i needed to have multiple formats in one field check out my blog on the subject:  

https://github.com/DOLEARY85/Power-BI-Replicate-Excel-Table

 

1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

This was just an information post

View solution in original post

2 REPLIES 2
DOLEARY85
Resident Rockstar
Resident Rockstar

This was just an information post

amitchandak
Super User
Super User

@DOLEARY85 , You have to work with total and Sub Total using isinscope and hasonevalue

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.