Forum Discussion
Issue in Inserting Formula in Table or Matrix View
How can I insert a formula-based value between two segments in a Power BI Table or Matrix visual?
Hi Padmavathy,
Thanks for reaching out to the Microsoft Fabric Community forum.If you want to add a formula-based value to a Table or Matrix visual, the appropriate calculation type depends on how you want the result to behave.
If the formula-based result needs to be available as a field in the Rows or Columns of the visual, you can create a calculated column using DAX. Microsoft documents that calculated columns are evaluated row by row and can be used in slicers, filters, rows, and columns of a visual.
If the result needs to be dynamically calculated based on the current report context, you can create a measure. Measures are evaluated as needed and their results can change based on filters, slicers, and other selections in the report. Microsoft documents that measures are used as values in a visual or in visual-level filters.
Therefore, if your requirement is specifically to display a calculated item between two existing segments/rows in the Matrix, please provide a small sample of your current data and the expected result (for example, Segment A → Calculated Value → Segment B). This will help determine the appropriate DAX/modeling approach for your exact requirement.
For more details, please refer to the below official Microsoft documentation:
Use Calculation Options in Power BI Desktop - Power BI | Microsoft LearnI hope this helps. Please feel free to reach out if you have any further questions.
Thank you.
8 Replies
- DanieleUgoCopp
Super User
Hello,
You can't just insert a formula between two existing segments like adding a column in Excel, but you can add a calculated column to your underlying data table that contains your formula, and then place that new column between your other segments in the matrix.
To do that, go to the Table view, right-click your table, and choose "New column" to write a DAX formula using values from existing columns or related tables.
Once that column exists, you can add it to the Columns well of your matrix visual, positioning it between your other segments.
If I help you, you can choose me as accepted solution
Thank you,
Kind regards,
Daniele - ShahRukhSameer
Solution Sage
Hi Padmavathy,
You can't directly insert a formula row between existing rows in a Table or Matrix visual, but there are a couple of workarounds depending on what you're trying to achieve.
If the value is just a calculation, create it as a measure and add it to the visual. For example:
Revenue = 100
Cost = 60
Profit = Revenue - Cost
If you need "Profit" to appear as a separate row between Revenue and Cost, the usual approach is to create a small disconnected table that defines the row order and then use a SWITCH measure to return the correct value for each row.
Something like:
Revenue
Profit
Cost
Then use a measure such as:
Display Value = SWITCH( SELECTEDVALUE(Layout[Row]), "Revenue", [Revenue], "Profit", [Revenue] - [Cost], "Cost", [Cost] )
I've used this approach before when users wanted calculated rows such as Gross Profit, Variance, or Margin % to appear in a specific position within a Matrix. It gives you full control over the row order and where the calculated values appear.
If you can share a screenshot or a small example of the two segments and the formula you want to insert between them, it will be easier to suggest the most suitable approach.
- danextian
Super User
Hi Padmavathy
There isn't enough context. Please share sample data (not a screenshot), your expected result, and the reasoning behind. A link to an Excel file or a sanitized copy of your PBIX is fine (confidential data removed).
- v-abhinavmu
Community Support
Hi Padmavathy,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you. - v-abhinavmu
Community Support
Hi Padmavathy,
May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.
Thank you- PadmavathyNew Member
- v-abhinavmu
Community Support
Hi Padmavathy,
Thanks for reaching out to the Microsoft Fabric Community forum.If you want to add a formula-based value to a Table or Matrix visual, the appropriate calculation type depends on how you want the result to behave.
If the formula-based result needs to be available as a field in the Rows or Columns of the visual, you can create a calculated column using DAX. Microsoft documents that calculated columns are evaluated row by row and can be used in slicers, filters, rows, and columns of a visual.
If the result needs to be dynamically calculated based on the current report context, you can create a measure. Measures are evaluated as needed and their results can change based on filters, slicers, and other selections in the report. Microsoft documents that measures are used as values in a visual or in visual-level filters.
Therefore, if your requirement is specifically to display a calculated item between two existing segments/rows in the Matrix, please provide a small sample of your current data and the expected result (for example, Segment A → Calculated Value → Segment B). This will help determine the appropriate DAX/modeling approach for your exact requirement.
For more details, please refer to the below official Microsoft documentation:
Use Calculation Options in Power BI Desktop - Power BI | Microsoft LearnI hope this helps. Please feel free to reach out if you have any further questions.
Thank you.
- v-abhinavmu
Community Support
Hi Padmavathy,
I wanted to follow up and check whether you had a chance to review the information provided. Please feel free to reach out if you have any further questions or need any additional assistance.
Thank you.