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.
I am preparing a PnL using the matrix visual in PowerBI with Months as Columns and Line Items as rows nested. All the data is coming from one table and all group names and line items are in the right order. The rows that are blank require calculations but the line names exist in the table. No values. I tried using a switch case but the measure returns blank. This a technique I am seeing for creating custom subtotal. Any Help, please?
Solved! Go to Solution.
Hi @Sagejah9,
According to you expected output, may be you can not do this.
It will pivot all the table when you drop column into values.
As:
Best Regards,
Link
Hi @Sagejah9,
Try measure as:
Measure =
IF(
HASONEFILTER(Table1[GroupName]),
SUM(Table1[Amount]),
[Total Revenue]-[Total Expenses])
And then modify the name of ‘subtotal’:
Here is the output:
Here is the demo, please try it: How to add a measure to a row of a matrix that is predefined?
Best Regards
Link
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
This is great, thanks! but how can I keep the Row totals for Revenue and Expense and used the NetProfit row that's already in the table, just that its values are either blank or 0, I would like to replace this with a measure. So, like going through row items (Groupnames) and allocating that measure when necessary.
Hi @Sagejah9,
According to you expected output, may be you can not do this.
It will pivot all the table when you drop column into values.
As:
Best Regards,
Link
can you share the calculation you are using and show with some visuals what you want to see.
Proud to be a Super User!
I made a sample PnL in excel to show the structure in the matrix visual and where I would like the calculated measure to fill. Not able to share the visual due to data privacy.
Measures:
Total Revenue = CALCULATE(SUM('Table1'[Amount]),'Table1'[GroupName] ="Revenue")
Total Expenses = CALCULATE(SUM('Table1'[Amount]),'Table1'[GroupName] ="Expenses")
Net Profit = [Total Revenue] - [Total Expenses]
Values_Measure = SWITCH(SELECTEDVALUE('Table1'[GroupName]), "Profit Before Tax", [Net Profit], CALCULATE(SUM('Table1'[Amount]))
I would like the resulting Matrix Table to look like this using the Values_Measure Measure in the row
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
105 | |
88 | |
74 | |
66 |
User | Count |
---|---|
126 | |
111 | |
100 | |
83 | |
71 |