Forum Discussion
Dynamic P&L Matrix In PBI with calculated rows
- Anonymous1 year ago
Hi, Anonymous
I changed the "3 - Total Net Operating Income/(Loss)" in your original formula to a "3 - Net Operating Income/(Loss)".
P&L Values = VAR Revenue = COALESCE([Operating Revenues], 0) VAR Expenditures = COALESCE([Net Operating Income], 0) VAR NetIncome = COALESCE([Net Operating Income], 0) VAR GainsLosses = COALESCE([Gains/Losses], 0) RETURN SWITCH( TRUE(), SELECTEDVALUE('Account Order Table'[Account Order]) = "3 - Net Operating Income/(Loss)", NetIncome, SELECTEDVALUE('Account Order Table'[Account Order]) = "1 - Revenues", Revenue, SELECTEDVALUE('Account Order Table'[Account Order]) = "2 - Expenditures", Expenditures, SELECTEDVALUE('Account Order Table'[Account Order]) = "4 - Gains/Losses", GainsLosses,0 )Is this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous1 year ago
YES!! I got the expected result! Thank you so much!!! - Kristi
Hi Anonymous
I can see a problem with the line with CALCULATE.
You are using a variable (NetIncome) when an expression is required. Because the variable is evaluated earlier and it can't be recalculated by CALCULATE means that the results will be incorrect.
It *might* be as easy as changing to
CALCULATE( [Operating Revenues] - [Operating Expenditures], ALLSELECTED('Account Order Table'))
but it would be tough to tell without sample data.
Let me know if you have any questions.
- gmsamborn1 year agoSuper User
Anonymous
You can upload xlsx or pbix to one of OneDrive, Google Drive, DropBox, WeTransfer and post the link here. You may have to change sharing rights depending on which you choose.
Also in your DAX both of these variables use the same measure:
VAR Expenditures = COALESCE([Net Operating Income], 0)VAR NetIncome = COALESCE([Net Operating Income], 0)- Anonymous1 year agoNot applicableLINK TO EXAMPLE FILE: https://drive.google.com/file/d/1H-63CxEb3M8w4sVfItD3BzsqtJ9etpyJ/view?usp=sharingThis is very simple fake data for the purpose of understanding how to get this to work.Thank you!
- Anonymous1 year agoNot applicable
Hi, Anonymous
I failed to open your link. Could you please follow the prompts for example files?
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.