Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
Solved! Go to Solution.
This was just an information post
@DOLEARY85 , You have to work with total and Sub Total using isinscope and hasonevalue
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 47 | |
| 43 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 196 | |
| 127 | |
| 102 | |
| 67 | |
| 49 |